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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.managednetworkfabric.models.AnnotationResource;
import com.azure.resourcemanager.managednetworkfabric.models.GatewayType;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Internet Gateway Properties defines the properties of the resource. */
@Fluent
public final class InternetGatewayProperties extends AnnotationResource {
    /*
     * IPv4 Address of Internet Gateway.
     */
    @JsonProperty(value = "ipv4Address", access = JsonProperty.Access.WRITE_ONLY)
    private String ipv4Address;

    /*
     * Port number of Internet Gateway.
     */
    @JsonProperty(value = "port", access = JsonProperty.Access.WRITE_ONLY)
    private Integer port;

    /*
     * Gateway Type of the resource.
     */
    @JsonProperty(value = "type", required = true)
    private GatewayType type;

    /*
     * ARM Resource ID of the Network Fabric Controller.
     */
    @JsonProperty(value = "networkFabricControllerId", required = true)
    private String networkFabricControllerId;

    /*
     * Provisioning state of resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * ARM Resource ID of the Internet Gateway Rule.
     */
    @JsonProperty(value = "internetGatewayRuleId")
    private String internetGatewayRuleId;

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

    /**
     * Get the ipv4Address property: IPv4 Address of Internet Gateway.
     *
     * @return the ipv4Address value.
     */
    public String ipv4Address() {
        return this.ipv4Address;
    }

    /**
     * Get the port property: Port number of Internet Gateway.
     *
     * @return the port value.
     */
    public Integer port() {
        return this.port;
    }

    /**
     * Get the type property: Gateway Type of the resource.
     *
     * @return the type value.
     */
    public GatewayType type() {
        return this.type;
    }

    /**
     * Set the type property: Gateway Type of the resource.
     *
     * @param type the type value to set.
     * @return the InternetGatewayProperties object itself.
     */
    public InternetGatewayProperties withType(GatewayType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the networkFabricControllerId property: ARM Resource ID of the Network Fabric Controller.
     *
     * @return the networkFabricControllerId value.
     */
    public String networkFabricControllerId() {
        return this.networkFabricControllerId;
    }

    /**
     * Set the networkFabricControllerId property: ARM Resource ID of the Network Fabric Controller.
     *
     * @param networkFabricControllerId the networkFabricControllerId value to set.
     * @return the InternetGatewayProperties object itself.
     */
    public InternetGatewayProperties withNetworkFabricControllerId(String networkFabricControllerId) {
        this.networkFabricControllerId = networkFabricControllerId;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the internetGatewayRuleId property: ARM Resource ID of the Internet Gateway Rule.
     *
     * @return the internetGatewayRuleId value.
     */
    public String internetGatewayRuleId() {
        return this.internetGatewayRuleId;
    }

    /**
     * Set the internetGatewayRuleId property: ARM Resource ID of the Internet Gateway Rule.
     *
     * @param internetGatewayRuleId the internetGatewayRuleId value to set.
     * @return the InternetGatewayProperties object itself.
     */
    public InternetGatewayProperties withInternetGatewayRuleId(String internetGatewayRuleId) {
        this.internetGatewayRuleId = internetGatewayRuleId;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public InternetGatewayProperties withAnnotation(String annotation) {
        super.withAnnotation(annotation);
        return this;
    }

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

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