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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.network.models.EndpointService;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Properties of the interface endpoint. */
@Fluent
public final class InterfaceEndpointPropertiesInner {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(InterfaceEndpointPropertiesInner.class);

    /*
     * A first-party service's FQDN that is mapped to the private IP allocated
     * via this interface endpoint.
     */
    @JsonProperty(value = "fqdn")
    private String fqdn;

    /*
     * A reference to the service being brought into the virtual network.
     */
    @JsonProperty(value = "endpointService")
    private EndpointService endpointService;

    /*
     * The ID of the subnet from which the private IP will be allocated.
     */
    @JsonProperty(value = "subnet")
    private SubnetInner subnet;

    /*
     * Gets an array of references to the network interfaces created for this
     * interface endpoint.
     */
    @JsonProperty(value = "networkInterfaces", access = JsonProperty.Access.WRITE_ONLY)
    private List<NetworkInterfaceInner> networkInterfaces;

    /*
     * A read-only property that identifies who created this interface
     * endpoint.
     */
    @JsonProperty(value = "owner", access = JsonProperty.Access.WRITE_ONLY)
    private String owner;

    /*
     * The provisioning state of the interface endpoint. Possible values are:
     * 'Updating', 'Deleting', and 'Failed'.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /**
     * Get the fqdn property: A first-party service's FQDN that is mapped to the private IP allocated via this interface
     * endpoint.
     *
     * @return the fqdn value.
     */
    public String fqdn() {
        return this.fqdn;
    }

    /**
     * Set the fqdn property: A first-party service's FQDN that is mapped to the private IP allocated via this interface
     * endpoint.
     *
     * @param fqdn the fqdn value to set.
     * @return the InterfaceEndpointPropertiesInner object itself.
     */
    public InterfaceEndpointPropertiesInner withFqdn(String fqdn) {
        this.fqdn = fqdn;
        return this;
    }

    /**
     * Get the endpointService property: A reference to the service being brought into the virtual network.
     *
     * @return the endpointService value.
     */
    public EndpointService endpointService() {
        return this.endpointService;
    }

    /**
     * Set the endpointService property: A reference to the service being brought into the virtual network.
     *
     * @param endpointService the endpointService value to set.
     * @return the InterfaceEndpointPropertiesInner object itself.
     */
    public InterfaceEndpointPropertiesInner withEndpointService(EndpointService endpointService) {
        this.endpointService = endpointService;
        return this;
    }

    /**
     * Get the subnet property: The ID of the subnet from which the private IP will be allocated.
     *
     * @return the subnet value.
     */
    public SubnetInner subnet() {
        return this.subnet;
    }

    /**
     * Set the subnet property: The ID of the subnet from which the private IP will be allocated.
     *
     * @param subnet the subnet value to set.
     * @return the InterfaceEndpointPropertiesInner object itself.
     */
    public InterfaceEndpointPropertiesInner withSubnet(SubnetInner subnet) {
        this.subnet = subnet;
        return this;
    }

    /**
     * Get the networkInterfaces property: Gets an array of references to the network interfaces created for this
     * interface endpoint.
     *
     * @return the networkInterfaces value.
     */
    public List<NetworkInterfaceInner> networkInterfaces() {
        return this.networkInterfaces;
    }

    /**
     * Get the owner property: A read-only property that identifies who created this interface endpoint.
     *
     * @return the owner value.
     */
    public String owner() {
        return this.owner;
    }

    /**
     * Get the provisioningState property: The provisioning state of the interface endpoint. Possible values are:
     * 'Updating', 'Deleting', and 'Failed'.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (endpointService() != null) {
            endpointService().validate();
        }
        if (subnet() != null) {
            subnet().validate();
        }
        if (networkInterfaces() != null) {
            networkInterfaces().forEach(e -> e.validate());
        }
    }
}
