// 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.resourcemanager.healthcareapis.models.FhirServiceAccessPolicyEntry;
import com.azure.resourcemanager.healthcareapis.models.FhirServiceAcrConfiguration;
import com.azure.resourcemanager.healthcareapis.models.FhirServiceAuthenticationConfiguration;
import com.azure.resourcemanager.healthcareapis.models.FhirServiceCorsConfiguration;
import com.azure.resourcemanager.healthcareapis.models.FhirServiceExportConfiguration;
import com.azure.resourcemanager.healthcareapis.models.FhirServiceKind;
import com.azure.resourcemanager.healthcareapis.models.PrivateEndpointConnection;
import com.azure.resourcemanager.healthcareapis.models.ProvisioningState;
import com.azure.resourcemanager.healthcareapis.models.PublicNetworkAccess;
import com.azure.resourcemanager.healthcareapis.models.ResourceVersionPolicyConfiguration;
import com.azure.resourcemanager.healthcareapis.models.ServiceEventState;
import com.azure.resourcemanager.healthcareapis.models.ServiceManagedIdentityIdentity;
import com.azure.resourcemanager.healthcareapis.models.TaggedResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The description of Fhir Service. */
@Fluent
public final class FhirServiceInner extends TaggedResource {
    /*
     * The kind of the service.
     */
    @JsonProperty(value = "kind")
    private FhirServiceKind kind;

    /*
     * Fhir Service configuration.
     */
    @JsonProperty(value = "properties")
    private FhirServiceProperties innerProperties;

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

    /*
     * Setting indicating whether the service has a managed identity associated
     * with it.
     */
    @JsonProperty(value = "identity")
    private ServiceManagedIdentityIdentity identity;

    /**
     * Get the kind property: The kind of the service.
     *
     * @return the kind value.
     */
    public FhirServiceKind kind() {
        return this.kind;
    }

    /**
     * Set the kind property: The kind of the service.
     *
     * @param kind the kind value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withKind(FhirServiceKind kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the innerProperties property: Fhir Service configuration.
     *
     * @return the innerProperties value.
     */
    private FhirServiceProperties 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;
    }

    /**
     * Get the identity property: Setting indicating whether the service has a managed identity associated with it.
     *
     * @return the identity value.
     */
    public ServiceManagedIdentityIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Setting indicating whether the service has a managed identity associated with it.
     *
     * @param identity the identity value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withIdentity(ServiceManagedIdentityIdentity identity) {
        this.identity = identity;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public FhirServiceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

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

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

    /**
     * Get the provisioningState property: The provisioning state.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the accessPolicies property: Fhir Service access policies.
     *
     * @return the accessPolicies value.
     */
    public List<FhirServiceAccessPolicyEntry> accessPolicies() {
        return this.innerProperties() == null ? null : this.innerProperties().accessPolicies();
    }

    /**
     * Set the accessPolicies property: Fhir Service access policies.
     *
     * @param accessPolicies the accessPolicies value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withAccessPolicies(List<FhirServiceAccessPolicyEntry> accessPolicies) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withAccessPolicies(accessPolicies);
        return this;
    }

    /**
     * Get the acrConfiguration property: Fhir Service Azure container registry configuration.
     *
     * @return the acrConfiguration value.
     */
    public FhirServiceAcrConfiguration acrConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().acrConfiguration();
    }

    /**
     * Set the acrConfiguration property: Fhir Service Azure container registry configuration.
     *
     * @param acrConfiguration the acrConfiguration value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withAcrConfiguration(FhirServiceAcrConfiguration acrConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withAcrConfiguration(acrConfiguration);
        return this;
    }

    /**
     * Get the authenticationConfiguration property: Fhir Service authentication configuration.
     *
     * @return the authenticationConfiguration value.
     */
    public FhirServiceAuthenticationConfiguration authenticationConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().authenticationConfiguration();
    }

    /**
     * Set the authenticationConfiguration property: Fhir Service authentication configuration.
     *
     * @param authenticationConfiguration the authenticationConfiguration value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withAuthenticationConfiguration(
        FhirServiceAuthenticationConfiguration authenticationConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withAuthenticationConfiguration(authenticationConfiguration);
        return this;
    }

    /**
     * Get the corsConfiguration property: Fhir Service Cors configuration.
     *
     * @return the corsConfiguration value.
     */
    public FhirServiceCorsConfiguration corsConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().corsConfiguration();
    }

    /**
     * Set the corsConfiguration property: Fhir Service Cors configuration.
     *
     * @param corsConfiguration the corsConfiguration value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withCorsConfiguration(FhirServiceCorsConfiguration corsConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withCorsConfiguration(corsConfiguration);
        return this;
    }

    /**
     * Get the exportConfiguration property: Fhir Service export configuration.
     *
     * @return the exportConfiguration value.
     */
    public FhirServiceExportConfiguration exportConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().exportConfiguration();
    }

    /**
     * Set the exportConfiguration property: Fhir Service export configuration.
     *
     * @param exportConfiguration the exportConfiguration value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withExportConfiguration(FhirServiceExportConfiguration exportConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withExportConfiguration(exportConfiguration);
        return this;
    }

    /**
     * Get the privateEndpointConnections property: The list of private endpoint connections that are set up for this
     * resource.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnection> privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

    /**
     * Get the publicNetworkAccess property: Control permission for data plane traffic coming from public networks while
     * private endpoint is enabled.
     *
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Control permission for data plane traffic coming from public networks while
     * private endpoint is enabled.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the eventState property: Fhir Service event support status.
     *
     * @return the eventState value.
     */
    public ServiceEventState eventState() {
        return this.innerProperties() == null ? null : this.innerProperties().eventState();
    }

    /**
     * Get the resourceVersionPolicyConfiguration property: Determines tracking of history for resources.
     *
     * @return the resourceVersionPolicyConfiguration value.
     */
    public ResourceVersionPolicyConfiguration resourceVersionPolicyConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceVersionPolicyConfiguration();
    }

    /**
     * Set the resourceVersionPolicyConfiguration property: Determines tracking of history for resources.
     *
     * @param resourceVersionPolicyConfiguration the resourceVersionPolicyConfiguration value to set.
     * @return the FhirServiceInner object itself.
     */
    public FhirServiceInner withResourceVersionPolicyConfiguration(
        ResourceVersionPolicyConfiguration resourceVersionPolicyConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FhirServiceProperties();
        }
        this.innerProperties().withResourceVersionPolicyConfiguration(resourceVersionPolicyConfiguration);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (innerProperties() != null) {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }
}
