// 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;

/** The connectivity check operation destination. */
@Fluent
public final class ConnectivityCheckRequestDestination {
    /*
     * Destination address. Can either be an IP address or a FQDN.
     */
    @JsonProperty(value = "address", required = true)
    private String address;

    /*
     * Destination port.
     */
    @JsonProperty(value = "port", required = true)
    private long port;

    /**
     * Get the address property: Destination address. Can either be an IP address or a FQDN.
     *
     * @return the address value.
     */
    public String address() {
        return this.address;
    }

    /**
     * Set the address property: Destination address. Can either be an IP address or a FQDN.
     *
     * @param address the address value to set.
     * @return the ConnectivityCheckRequestDestination object itself.
     */
    public ConnectivityCheckRequestDestination withAddress(String address) {
        this.address = address;
        return this;
    }

    /**
     * Get the port property: Destination port.
     *
     * @return the port value.
     */
    public long port() {
        return this.port;
    }

    /**
     * Set the port property: Destination port.
     *
     * @param port the port value to set.
     * @return the ConnectivityCheckRequestDestination object itself.
     */
    public ConnectivityCheckRequestDestination withPort(long port) {
        this.port = port;
        return this;
    }

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

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