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

package com.azure.resourcemanager.networkcloud.models;

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

/** EndpointDependency represents the definition of an endpoint, including the domain and details. */
@Fluent
public final class EndpointDependency {
    /*
     * The domain name of the dependency.
     */
    @JsonProperty(value = "domainName", required = true)
    private String domainName;

    /*
     * The port of this endpoint.
     */
    @JsonProperty(value = "port")
    private Long port;

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

    /**
     * Get the domainName property: The domain name of the dependency.
     *
     * @return the domainName value.
     */
    public String domainName() {
        return this.domainName;
    }

    /**
     * Set the domainName property: The domain name of the dependency.
     *
     * @param domainName the domainName value to set.
     * @return the EndpointDependency object itself.
     */
    public EndpointDependency withDomainName(String domainName) {
        this.domainName = domainName;
        return this;
    }

    /**
     * Get the port property: The port of this endpoint.
     *
     * @return the port value.
     */
    public Long port() {
        return this.port;
    }

    /**
     * Set the port property: The port of this endpoint.
     *
     * @param port the port value to set.
     * @return the EndpointDependency object itself.
     */
    public EndpointDependency withPort(Long port) {
        this.port = port;
        return this;
    }

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

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