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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.peering.models.ContactDetail;
import com.azure.resourcemanager.peering.models.ValidationState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The properties that define a peer's ASN. */
@Fluent
public final class PeerAsnProperties {
    /*
     * The Autonomous System Number (ASN) of the peer.
     */
    @JsonProperty(value = "peerAsn")
    private Integer peerAsn;

    /*
     * The contact details of the peer.
     */
    @JsonProperty(value = "peerContactDetail")
    private List<ContactDetail> peerContactDetail;

    /*
     * The name of the peer.
     */
    @JsonProperty(value = "peerName")
    private String peerName;

    /*
     * The validation state of the ASN associated with the peer.
     */
    @JsonProperty(value = "validationState")
    private ValidationState validationState;

    /*
     * The error message for the validation state
     */
    @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String errorMessage;

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

    /**
     * Get the peerAsn property: The Autonomous System Number (ASN) of the peer.
     *
     * @return the peerAsn value.
     */
    public Integer peerAsn() {
        return this.peerAsn;
    }

    /**
     * Set the peerAsn property: The Autonomous System Number (ASN) of the peer.
     *
     * @param peerAsn the peerAsn value to set.
     * @return the PeerAsnProperties object itself.
     */
    public PeerAsnProperties withPeerAsn(Integer peerAsn) {
        this.peerAsn = peerAsn;
        return this;
    }

    /**
     * Get the peerContactDetail property: The contact details of the peer.
     *
     * @return the peerContactDetail value.
     */
    public List<ContactDetail> peerContactDetail() {
        return this.peerContactDetail;
    }

    /**
     * Set the peerContactDetail property: The contact details of the peer.
     *
     * @param peerContactDetail the peerContactDetail value to set.
     * @return the PeerAsnProperties object itself.
     */
    public PeerAsnProperties withPeerContactDetail(List<ContactDetail> peerContactDetail) {
        this.peerContactDetail = peerContactDetail;
        return this;
    }

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

    /**
     * Set the peerName property: The name of the peer.
     *
     * @param peerName the peerName value to set.
     * @return the PeerAsnProperties object itself.
     */
    public PeerAsnProperties withPeerName(String peerName) {
        this.peerName = peerName;
        return this;
    }

    /**
     * Get the validationState property: The validation state of the ASN associated with the peer.
     *
     * @return the validationState value.
     */
    public ValidationState validationState() {
        return this.validationState;
    }

    /**
     * Set the validationState property: The validation state of the ASN associated with the peer.
     *
     * @param validationState the validationState value to set.
     * @return the PeerAsnProperties object itself.
     */
    public PeerAsnProperties withValidationState(ValidationState validationState) {
        this.validationState = validationState;
        return this;
    }

    /**
     * Get the errorMessage property: The error message for the validation state.
     *
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.errorMessage;
    }

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