// 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.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.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.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Fhir Service properties. */
@Fluent
public final class FhirServiceProperties {
    /*
     * The provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * Fhir Service access policies.
     */
    @JsonProperty(value = "accessPolicies")
    private List<FhirServiceAccessPolicyEntry> accessPolicies;

    /*
     * Fhir Service Azure container registry configuration.
     */
    @JsonProperty(value = "acrConfiguration")
    private FhirServiceAcrConfiguration acrConfiguration;

    /*
     * Fhir Service authentication configuration.
     */
    @JsonProperty(value = "authenticationConfiguration")
    private FhirServiceAuthenticationConfiguration authenticationConfiguration;

    /*
     * Fhir Service Cors configuration.
     */
    @JsonProperty(value = "corsConfiguration")
    private FhirServiceCorsConfiguration corsConfiguration;

    /*
     * Fhir Service export configuration.
     */
    @JsonProperty(value = "exportConfiguration")
    private FhirServiceExportConfiguration exportConfiguration;

    /*
     * The list of private endpoint connections that are set up for this
     * resource.
     */
    @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY)
    private List<PrivateEndpointConnection> privateEndpointConnections;

    /*
     * Control permission for data plane traffic coming from public networks
     * while private endpoint is enabled.
     */
    @JsonProperty(value = "publicNetworkAccess")
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * Fhir Service event support status.
     */
    @JsonProperty(value = "eventState", access = JsonProperty.Access.WRITE_ONLY)
    private ServiceEventState eventState;

    /*
     * Determines tracking of history for resources.
     */
    @JsonProperty(value = "resourceVersionPolicyConfiguration")
    private ResourceVersionPolicyConfiguration resourceVersionPolicyConfiguration;

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

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

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

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

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

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

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

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

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

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

    /**
     * Set the exportConfiguration property: Fhir Service export configuration.
     *
     * @param exportConfiguration the exportConfiguration value to set.
     * @return the FhirServiceProperties object itself.
     */
    public FhirServiceProperties withExportConfiguration(FhirServiceExportConfiguration exportConfiguration) {
        this.exportConfiguration = 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.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.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 FhirServiceProperties object itself.
     */
    public FhirServiceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

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

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

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

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (accessPolicies() != null) {
            accessPolicies().forEach(e -> e.validate());
        }
        if (acrConfiguration() != null) {
            acrConfiguration().validate();
        }
        if (authenticationConfiguration() != null) {
            authenticationConfiguration().validate();
        }
        if (corsConfiguration() != null) {
            corsConfiguration().validate();
        }
        if (exportConfiguration() != null) {
            exportConfiguration().validate();
        }
        if (privateEndpointConnections() != null) {
            privateEndpointConnections().forEach(e -> e.validate());
        }
        if (resourceVersionPolicyConfiguration() != null) {
            resourceVersionPolicyConfiguration().validate();
        }
    }
}
