// 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.NetworkDeviceRoleTypes;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** NetworkDeviceProperties define the resource properties. */
@Fluent
public final class NetworkDeviceProperties extends AnnotationResource {
    /*
     * Current version of the device as defined in SKU.
     */
    @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY)
    private String version;

    /*
     * Network Device SKU name.
     */
    @JsonProperty(value = "networkDeviceSku", required = true)
    private String networkDeviceSku;

    /*
     * networkDeviceRole is the device role: Example: CE | ToR.
     */
    @JsonProperty(value = "networkDeviceRole", required = true)
    private NetworkDeviceRoleTypes networkDeviceRole;

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

    /*
     * Reference to network rack resource id.
     */
    @JsonProperty(value = "networkRackId", access = JsonProperty.Access.WRITE_ONLY)
    private String networkRackId;

    /*
     * The host Name of the device.
     */
    @JsonProperty(value = "hostName")
    private String hostname;

    /*
     * serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. Example:
     * Arista;DCS-7280DR3-24;12.05;JPE21116969
     */
    @JsonProperty(value = "serialNumber")
    private String serialNumber;

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

    /**
     * Get the version property: Current version of the device as defined in SKU.
     *
     * @return the version value.
     */
    public String version() {
        return this.version;
    }

    /**
     * Get the networkDeviceSku property: Network Device SKU name.
     *
     * @return the networkDeviceSku value.
     */
    public String networkDeviceSku() {
        return this.networkDeviceSku;
    }

    /**
     * Set the networkDeviceSku property: Network Device SKU name.
     *
     * @param networkDeviceSku the networkDeviceSku value to set.
     * @return the NetworkDeviceProperties object itself.
     */
    public NetworkDeviceProperties withNetworkDeviceSku(String networkDeviceSku) {
        this.networkDeviceSku = networkDeviceSku;
        return this;
    }

    /**
     * Get the networkDeviceRole property: networkDeviceRole is the device role: Example: CE | ToR.
     *
     * @return the networkDeviceRole value.
     */
    public NetworkDeviceRoleTypes networkDeviceRole() {
        return this.networkDeviceRole;
    }

    /**
     * Set the networkDeviceRole property: networkDeviceRole is the device role: Example: CE | ToR.
     *
     * @param networkDeviceRole the networkDeviceRole value to set.
     * @return the NetworkDeviceProperties object itself.
     */
    public NetworkDeviceProperties withNetworkDeviceRole(NetworkDeviceRoleTypes networkDeviceRole) {
        this.networkDeviceRole = networkDeviceRole;
        return this;
    }

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

    /**
     * Get the networkRackId property: Reference to network rack resource id.
     *
     * @return the networkRackId value.
     */
    public String networkRackId() {
        return this.networkRackId;
    }

    /**
     * Get the hostname property: The host Name of the device.
     *
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Set the hostname property: The host Name of the device.
     *
     * @param hostname the hostname value to set.
     * @return the NetworkDeviceProperties object itself.
     */
    public NetworkDeviceProperties withHostname(String hostname) {
        this.hostname = hostname;
        return this;
    }

    /**
     * Get the serialNumber property: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. Example:
     * Arista;DCS-7280DR3-24;12.05;JPE21116969.
     *
     * @return the serialNumber value.
     */
    public String serialNumber() {
        return this.serialNumber;
    }

    /**
     * Set the serialNumber property: serialNumber of the format Make;Model;HardwareRevisionId;SerialNumber. Example:
     * Arista;DCS-7280DR3-24;12.05;JPE21116969.
     *
     * @param serialNumber the serialNumber value to set.
     * @return the NetworkDeviceProperties object itself.
     */
    public NetworkDeviceProperties withSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public NetworkDeviceProperties 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 (networkDeviceSku() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property networkDeviceSku in model NetworkDeviceProperties"));
        }
        if (networkDeviceRole() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property networkDeviceRole in model NetworkDeviceProperties"));
        }
    }

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