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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope;
import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform;
import com.azure.resourcemanager.voiceservices.models.Connectivity;
import com.azure.resourcemanager.voiceservices.models.E911Type;
import com.azure.resourcemanager.voiceservices.models.ProvisioningState;
import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties;
import com.azure.resourcemanager.voiceservices.models.Status;
import com.azure.resourcemanager.voiceservices.models.TeamsCodecs;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Details of the CommunicationsGateway resource. */
@Fluent
public final class CommunicationsGatewayProperties {
    /*
     * Resource provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * The current status of the deployment.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private Status status;

    /*
     * The regions in which to deploy the resources needed for Teams Calling
     */
    @JsonProperty(value = "serviceLocations", required = true)
    private List<ServiceRegionProperties> serviceLocations;

    /*
     * How to connect back to the operator network, e.g. MAPS
     */
    @JsonProperty(value = "connectivity", required = true)
    private Connectivity connectivity;

    /*
     * Voice codecs to support
     */
    @JsonProperty(value = "codecs", required = true)
    private List<TeamsCodecs> codecs;

    /*
     * How to handle 911 calls
     */
    @JsonProperty(value = "e911Type", required = true)
    private E911Type e911Type;

    /*
     * What platforms to support
     */
    @JsonProperty(value = "platforms", required = true)
    private List<CommunicationsPlatform> platforms;

    /*
     * Details of API bridge functionality, if required
     */
    @JsonProperty(value = "apiBridge")
    private Object apiBridge;

    /*
     * The scope at which the auto-generated domain name can be re-used
     */
    @JsonProperty(value = "autoGeneratedDomainNameLabelScope")
    private AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope;

    /*
     * The autogenerated label used as part of the FQDNs for accessing the Communications Gateway
     */
    @JsonProperty(value = "autoGeneratedDomainNameLabel", access = JsonProperty.Access.WRITE_ONLY)
    private String autoGeneratedDomainNameLabel;

    /*
     * This number is used in Teams Phone Mobile scenarios for access to the voicemail IVR from the native dialer.
     */
    @JsonProperty(value = "teamsVoicemailPilotNumber")
    private String teamsVoicemailPilotNumber;

    /*
     * Whether an on-premises Mobile Control Point is in use.
     */
    @JsonProperty(value = "onPremMcpEnabled")
    private Boolean onPremMcpEnabled;

    /*
     * A list of dial strings used for emergency calling.
     */
    @JsonProperty(value = "emergencyDialStrings")
    private List<String> emergencyDialStrings;

    /** Creates an instance of CommunicationsGatewayProperties class. */
    public CommunicationsGatewayProperties() {
    }

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

    /**
     * Get the status property: The current status of the deployment.
     *
     * @return the status value.
     */
    public Status status() {
        return this.status;
    }

    /**
     * Get the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling.
     *
     * @return the serviceLocations value.
     */
    public List<ServiceRegionProperties> serviceLocations() {
        return this.serviceLocations;
    }

    /**
     * Set the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling.
     *
     * @param serviceLocations the serviceLocations value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withServiceLocations(List<ServiceRegionProperties> serviceLocations) {
        this.serviceLocations = serviceLocations;
        return this;
    }

    /**
     * Get the connectivity property: How to connect back to the operator network, e.g. MAPS.
     *
     * @return the connectivity value.
     */
    public Connectivity connectivity() {
        return this.connectivity;
    }

    /**
     * Set the connectivity property: How to connect back to the operator network, e.g. MAPS.
     *
     * @param connectivity the connectivity value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withConnectivity(Connectivity connectivity) {
        this.connectivity = connectivity;
        return this;
    }

    /**
     * Get the codecs property: Voice codecs to support.
     *
     * @return the codecs value.
     */
    public List<TeamsCodecs> codecs() {
        return this.codecs;
    }

    /**
     * Set the codecs property: Voice codecs to support.
     *
     * @param codecs the codecs value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withCodecs(List<TeamsCodecs> codecs) {
        this.codecs = codecs;
        return this;
    }

    /**
     * Get the e911Type property: How to handle 911 calls.
     *
     * @return the e911Type value.
     */
    public E911Type e911Type() {
        return this.e911Type;
    }

    /**
     * Set the e911Type property: How to handle 911 calls.
     *
     * @param e911Type the e911Type value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withE911Type(E911Type e911Type) {
        this.e911Type = e911Type;
        return this;
    }

    /**
     * Get the platforms property: What platforms to support.
     *
     * @return the platforms value.
     */
    public List<CommunicationsPlatform> platforms() {
        return this.platforms;
    }

    /**
     * Set the platforms property: What platforms to support.
     *
     * @param platforms the platforms value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withPlatforms(List<CommunicationsPlatform> platforms) {
        this.platforms = platforms;
        return this;
    }

    /**
     * Get the apiBridge property: Details of API bridge functionality, if required.
     *
     * @return the apiBridge value.
     */
    public Object apiBridge() {
        return this.apiBridge;
    }

    /**
     * Set the apiBridge property: Details of API bridge functionality, if required.
     *
     * @param apiBridge the apiBridge value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withApiBridge(Object apiBridge) {
        this.apiBridge = apiBridge;
        return this;
    }

    /**
     * Get the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be
     * re-used.
     *
     * @return the autoGeneratedDomainNameLabelScope value.
     */
    public AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope() {
        return this.autoGeneratedDomainNameLabelScope;
    }

    /**
     * Set the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be
     * re-used.
     *
     * @param autoGeneratedDomainNameLabelScope the autoGeneratedDomainNameLabelScope value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withAutoGeneratedDomainNameLabelScope(
        AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope) {
        this.autoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope;
        return this;
    }

    /**
     * Get the autoGeneratedDomainNameLabel property: The autogenerated label used as part of the FQDNs for accessing
     * the Communications Gateway.
     *
     * @return the autoGeneratedDomainNameLabel value.
     */
    public String autoGeneratedDomainNameLabel() {
        return this.autoGeneratedDomainNameLabel;
    }

    /**
     * Get the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the
     * voicemail IVR from the native dialer.
     *
     * @return the teamsVoicemailPilotNumber value.
     */
    public String teamsVoicemailPilotNumber() {
        return this.teamsVoicemailPilotNumber;
    }

    /**
     * Set the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the
     * voicemail IVR from the native dialer.
     *
     * @param teamsVoicemailPilotNumber the teamsVoicemailPilotNumber value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withTeamsVoicemailPilotNumber(String teamsVoicemailPilotNumber) {
        this.teamsVoicemailPilotNumber = teamsVoicemailPilotNumber;
        return this;
    }

    /**
     * Get the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use.
     *
     * @return the onPremMcpEnabled value.
     */
    public Boolean onPremMcpEnabled() {
        return this.onPremMcpEnabled;
    }

    /**
     * Set the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use.
     *
     * @param onPremMcpEnabled the onPremMcpEnabled value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withOnPremMcpEnabled(Boolean onPremMcpEnabled) {
        this.onPremMcpEnabled = onPremMcpEnabled;
        return this;
    }

    /**
     * Get the emergencyDialStrings property: A list of dial strings used for emergency calling.
     *
     * @return the emergencyDialStrings value.
     */
    public List<String> emergencyDialStrings() {
        return this.emergencyDialStrings;
    }

    /**
     * Set the emergencyDialStrings property: A list of dial strings used for emergency calling.
     *
     * @param emergencyDialStrings the emergencyDialStrings value to set.
     * @return the CommunicationsGatewayProperties object itself.
     */
    public CommunicationsGatewayProperties withEmergencyDialStrings(List<String> emergencyDialStrings) {
        this.emergencyDialStrings = emergencyDialStrings;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (serviceLocations() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property serviceLocations in model CommunicationsGatewayProperties"));
        } else {
            serviceLocations().forEach(e -> e.validate());
        }
        if (connectivity() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property connectivity in model CommunicationsGatewayProperties"));
        }
        if (codecs() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property codecs in model CommunicationsGatewayProperties"));
        }
        if (e911Type() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property e911Type in model CommunicationsGatewayProperties"));
        }
        if (platforms() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property platforms in model CommunicationsGatewayProperties"));
        }
    }

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