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

package com.azure.resourcemanager.apimanagement.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Description of an additional API Management resource location. */
@Fluent
public final class AdditionalLocation {
    /*
     * The location name of the additional region among Azure Data center
     * regions.
     */
    @JsonProperty(value = "location", required = true)
    private String location;

    /*
     * SKU properties of the API Management service.
     */
    @JsonProperty(value = "sku", required = true)
    private ApiManagementServiceSkuProperties sku;

    /*
     * A list of availability zones denoting where the resource needs to come
     * from.
     */
    @JsonProperty(value = "zones")
    private List<String> zones;

    /*
     * Public Static Load Balanced IP addresses of the API Management service
     * in the additional location. Available only for Basic, Standard, Premium
     * and Isolated SKU.
     */
    @JsonProperty(value = "publicIPAddresses", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> publicIpAddresses;

    /*
     * Private Static Load Balanced IP addresses of the API Management service
     * which is deployed in an Internal Virtual Network in a particular
     * additional location. Available only for Basic, Standard, Premium and
     * Isolated SKU.
     */
    @JsonProperty(value = "privateIPAddresses", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> privateIpAddresses;

    /*
     * Public Standard SKU IP V4 based IP address to be associated with Virtual
     * Network deployed service in the location. Supported only for Premium SKU
     * being deployed in Virtual Network.
     */
    @JsonProperty(value = "publicIpAddressId")
    private String publicIpAddressId;

    /*
     * Virtual network configuration for the location.
     */
    @JsonProperty(value = "virtualNetworkConfiguration")
    private VirtualNetworkConfiguration virtualNetworkConfiguration;

    /*
     * Gateway URL of the API Management service in the Region.
     */
    @JsonProperty(value = "gatewayRegionalUrl", access = JsonProperty.Access.WRITE_ONLY)
    private String gatewayRegionalUrl;

    /*
     * Property only valid for an Api Management service deployed in multiple
     * locations. This can be used to disable the gateway in this additional
     * location.
     */
    @JsonProperty(value = "disableGateway")
    private Boolean disableGateway;

    /*
     * Compute Platform Version running the service.
     */
    @JsonProperty(value = "platformVersion", access = JsonProperty.Access.WRITE_ONLY)
    private PlatformVersion platformVersion;

    /**
     * Get the location property: The location name of the additional region among Azure Data center regions.
     *
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The location name of the additional region among Azure Data center regions.
     *
     * @param location the location value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the sku property: SKU properties of the API Management service.
     *
     * @return the sku value.
     */
    public ApiManagementServiceSkuProperties sku() {
        return this.sku;
    }

    /**
     * Set the sku property: SKU properties of the API Management service.
     *
     * @param sku the sku value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withSku(ApiManagementServiceSkuProperties sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the zones property: A list of availability zones denoting where the resource needs to come from.
     *
     * @return the zones value.
     */
    public List<String> zones() {
        return this.zones;
    }

    /**
     * Set the zones property: A list of availability zones denoting where the resource needs to come from.
     *
     * @param zones the zones value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withZones(List<String> zones) {
        this.zones = zones;
        return this;
    }

    /**
     * Get the publicIpAddresses property: Public Static Load Balanced IP addresses of the API Management service in the
     * additional location. Available only for Basic, Standard, Premium and Isolated SKU.
     *
     * @return the publicIpAddresses value.
     */
    public List<String> publicIpAddresses() {
        return this.publicIpAddresses;
    }

    /**
     * Get the privateIpAddresses property: Private Static Load Balanced IP addresses of the API Management service
     * which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic,
     * Standard, Premium and Isolated SKU.
     *
     * @return the privateIpAddresses value.
     */
    public List<String> privateIpAddresses() {
        return this.privateIpAddresses;
    }

    /**
     * Get the publicIpAddressId property: Public Standard SKU IP V4 based IP address to be associated with Virtual
     * Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network.
     *
     * @return the publicIpAddressId value.
     */
    public String publicIpAddressId() {
        return this.publicIpAddressId;
    }

    /**
     * Set the publicIpAddressId property: Public Standard SKU IP V4 based IP address to be associated with Virtual
     * Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network.
     *
     * @param publicIpAddressId the publicIpAddressId value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withPublicIpAddressId(String publicIpAddressId) {
        this.publicIpAddressId = publicIpAddressId;
        return this;
    }

    /**
     * Get the virtualNetworkConfiguration property: Virtual network configuration for the location.
     *
     * @return the virtualNetworkConfiguration value.
     */
    public VirtualNetworkConfiguration virtualNetworkConfiguration() {
        return this.virtualNetworkConfiguration;
    }

    /**
     * Set the virtualNetworkConfiguration property: Virtual network configuration for the location.
     *
     * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) {
        this.virtualNetworkConfiguration = virtualNetworkConfiguration;
        return this;
    }

    /**
     * Get the gatewayRegionalUrl property: Gateway URL of the API Management service in the Region.
     *
     * @return the gatewayRegionalUrl value.
     */
    public String gatewayRegionalUrl() {
        return this.gatewayRegionalUrl;
    }

    /**
     * Get the disableGateway property: Property only valid for an Api Management service deployed in multiple
     * locations. This can be used to disable the gateway in this additional location.
     *
     * @return the disableGateway value.
     */
    public Boolean disableGateway() {
        return this.disableGateway;
    }

    /**
     * Set the disableGateway property: Property only valid for an Api Management service deployed in multiple
     * locations. This can be used to disable the gateway in this additional location.
     *
     * @param disableGateway the disableGateway value to set.
     * @return the AdditionalLocation object itself.
     */
    public AdditionalLocation withDisableGateway(Boolean disableGateway) {
        this.disableGateway = disableGateway;
        return this;
    }

    /**
     * Get the platformVersion property: Compute Platform Version running the service.
     *
     * @return the platformVersion value.
     */
    public PlatformVersion platformVersion() {
        return this.platformVersion;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (location() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property location in model AdditionalLocation"));
        }
        if (sku() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property sku in model AdditionalLocation"));
        } else {
            sku().validate();
        }
        if (virtualNetworkConfiguration() != null) {
            virtualNetworkConfiguration().validate();
        }
    }

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