// 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.management.Resource;
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;
import java.util.Map;

/** Interface endpoint resource. */
@Fluent
public final class InterfaceEndpointInner extends Resource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(InterfaceEndpointInner.class);

    /*
     * Properties of the interface endpoint.
     */
    @JsonProperty(value = "properties")
    private InterfaceEndpointPropertiesInner innerProperties;

    /*
     * Gets a unique read-only string that changes whenever the resource is
     * updated.
     */
    @JsonProperty(value = "etag")
    private String etag;

    /*
     * Resource ID.
     */
    @JsonProperty(value = "id")
    private String id;

    /**
     * Get the innerProperties property: Properties of the interface endpoint.
     *
     * @return the innerProperties value.
     */
    private InterfaceEndpointPropertiesInner innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: Gets a unique read-only string that changes whenever the resource is updated.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: Gets a unique read-only string that changes whenever the resource is updated.
     *
     * @param etag the etag value to set.
     * @return the InterfaceEndpointInner object itself.
     */
    public InterfaceEndpointInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the id property: Resource ID.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Resource ID.
     *
     * @param id the id value to set.
     * @return the InterfaceEndpointInner object itself.
     */
    public InterfaceEndpointInner withId(String id) {
        this.id = id;
        return this;
    }

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

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

    /**
     * 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.innerProperties() == null ? null : this.innerProperties().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 InterfaceEndpointInner object itself.
     */
    public InterfaceEndpointInner withFqdn(String fqdn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InterfaceEndpointPropertiesInner();
        }
        this.innerProperties().withFqdn(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.innerProperties() == null ? null : this.innerProperties().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 InterfaceEndpointInner object itself.
     */
    public InterfaceEndpointInner withEndpointService(EndpointService endpointService) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InterfaceEndpointPropertiesInner();
        }
        this.innerProperties().withEndpointService(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.innerProperties() == null ? null : this.innerProperties().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 InterfaceEndpointInner object itself.
     */
    public InterfaceEndpointInner withSubnet(SubnetInner subnet) {
        if (this.innerProperties() == null) {
            this.innerProperties = new InterfaceEndpointPropertiesInner();
        }
        this.innerProperties().withSubnet(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

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