// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.healthcareapis.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.healthcareapis.models.IotIdentityResolutionType;
import com.azure.resourcemanager.healthcareapis.models.IotMappingProperties;
import com.azure.resourcemanager.healthcareapis.models.LocationBasedResource;
import com.fasterxml.jackson.annotation.JsonProperty;

/** IoT Connector FHIR destination definition. */
@Fluent
public final class IotFhirDestinationInner extends LocationBasedResource {
    /*
     * IoT FHIR Destination settings.
     */
    @JsonProperty(value = "properties", required = true)
    private IotFhirDestinationProperties innerProperties = new IotFhirDestinationProperties();

    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the innerProperties property: IoT FHIR Destination settings.
     *
     * @return the innerProperties value.
     */
    private IotFhirDestinationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public IotFhirDestinationInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public IotFhirDestinationInner withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the resourceIdentityResolutionType property: Determines how resource identity is resolved on the destination.
     *
     * @return the resourceIdentityResolutionType value.
     */
    public IotIdentityResolutionType resourceIdentityResolutionType() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceIdentityResolutionType();
    }

    /**
     * Set the resourceIdentityResolutionType property: Determines how resource identity is resolved on the destination.
     *
     * @param resourceIdentityResolutionType the resourceIdentityResolutionType value to set.
     * @return the IotFhirDestinationInner object itself.
     */
    public IotFhirDestinationInner withResourceIdentityResolutionType(
        IotIdentityResolutionType resourceIdentityResolutionType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotFhirDestinationProperties();
        }
        this.innerProperties().withResourceIdentityResolutionType(resourceIdentityResolutionType);
        return this;
    }

    /**
     * Get the fhirServiceResourceId property: Fully qualified resource id of the FHIR service to connect to.
     *
     * @return the fhirServiceResourceId value.
     */
    public String fhirServiceResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().fhirServiceResourceId();
    }

    /**
     * Set the fhirServiceResourceId property: Fully qualified resource id of the FHIR service to connect to.
     *
     * @param fhirServiceResourceId the fhirServiceResourceId value to set.
     * @return the IotFhirDestinationInner object itself.
     */
    public IotFhirDestinationInner withFhirServiceResourceId(String fhirServiceResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotFhirDestinationProperties();
        }
        this.innerProperties().withFhirServiceResourceId(fhirServiceResourceId);
        return this;
    }

    /**
     * Get the fhirMapping property: FHIR Mappings.
     *
     * @return the fhirMapping value.
     */
    public IotMappingProperties fhirMapping() {
        return this.innerProperties() == null ? null : this.innerProperties().fhirMapping();
    }

    /**
     * Set the fhirMapping property: FHIR Mappings.
     *
     * @param fhirMapping the fhirMapping value to set.
     * @return the IotFhirDestinationInner object itself.
     */
    public IotFhirDestinationInner withFhirMapping(IotMappingProperties fhirMapping) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotFhirDestinationProperties();
        }
        this.innerProperties().withFhirMapping(fhirMapping);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model IotFhirDestinationInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(IotFhirDestinationInner.class);
}
