// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.networkcloud.models.ExtendedLocation;
import com.azure.resourcemanager.networkcloud.models.RackDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.RackProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Rack represents the hardware of the rack and is dependent upon the cluster for lifecycle. */
@Fluent
public final class RackInner extends Resource {
    /*
     * ExtendedLocation represents the Azure custom location where the resource will be created.
     *
     * The extended location of the cluster associated with the resource.
     */
    @JsonProperty(value = "extendedLocation", required = true)
    private ExtendedLocation extendedLocation;

    /*
     * RackProperties represents the properties of the rack.
     *
     * The list of the resource properties.
     */
    @JsonProperty(value = "properties", required = true)
    private RackProperties innerProperties = new RackProperties();

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the extendedLocation property: ExtendedLocation represents the Azure custom location where the resource will
     * be created.
     *
     * <p>The extended location of the cluster associated with the resource.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: ExtendedLocation represents the Azure custom location where the resource will
     * be created.
     *
     * <p>The extended location of the cluster associated with the resource.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the RackInner object itself.
     */
    public RackInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the innerProperties property: RackProperties represents the properties of the rack.
     *
     * <p>The list of the resource properties.
     *
     * @return the innerProperties value.
     */
    private RackProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public RackInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public RackInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the availabilityZone property: The value that will be used for machines in this rack to represent the
     * availability zones that can be referenced by Hybrid AKS Clusters for node arrangement.
     *
     * @return the availabilityZone value.
     */
    public String availabilityZone() {
        return this.innerProperties() == null ? null : this.innerProperties().availabilityZone();
    }

    /**
     * Set the availabilityZone property: The value that will be used for machines in this rack to represent the
     * availability zones that can be referenced by Hybrid AKS Clusters for node arrangement.
     *
     * @param availabilityZone the availabilityZone value to set.
     * @return the RackInner object itself.
     */
    public RackInner withAvailabilityZone(String availabilityZone) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RackProperties();
        }
        this.innerProperties().withAvailabilityZone(availabilityZone);
        return this;
    }

    /**
     * Get the clusterId property: The resource ID of the cluster the rack is created for. This value is set when the
     * rack is created by the cluster.
     *
     * @return the clusterId value.
     */
    public String clusterId() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterId();
    }

    /**
     * Get the detailedStatus property: The more detailed status of the rack.
     *
     * @return the detailedStatus value.
     */
    public RackDetailedStatus detailedStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().detailedStatus();
    }

    /**
     * Get the detailedStatusMessage property: The descriptive message about the current detailed status.
     *
     * @return the detailedStatusMessage value.
     */
    public String detailedStatusMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().detailedStatusMessage();
    }

    /**
     * Get the provisioningState property: The provisioning state of the rack resource.
     *
     * @return the provisioningState value.
     */
    public RackProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the rackLocation property: The free-form description of the rack location. (e.g. “DTN Datacenter, Floor 3,
     * Isle 9, Rack 2B”).
     *
     * @return the rackLocation value.
     */
    public String rackLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().rackLocation();
    }

    /**
     * Set the rackLocation property: The free-form description of the rack location. (e.g. “DTN Datacenter, Floor 3,
     * Isle 9, Rack 2B”).
     *
     * @param rackLocation the rackLocation value to set.
     * @return the RackInner object itself.
     */
    public RackInner withRackLocation(String rackLocation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RackProperties();
        }
        this.innerProperties().withRackLocation(rackLocation);
        return this;
    }

    /**
     * Get the rackSerialNumber property: The unique identifier for the rack within Network Cloud cluster. An alternate
     * unique alphanumeric value other than a serial number may be provided if desired.
     *
     * @return the rackSerialNumber value.
     */
    public String rackSerialNumber() {
        return this.innerProperties() == null ? null : this.innerProperties().rackSerialNumber();
    }

    /**
     * Set the rackSerialNumber property: The unique identifier for the rack within Network Cloud cluster. An alternate
     * unique alphanumeric value other than a serial number may be provided if desired.
     *
     * @param rackSerialNumber the rackSerialNumber value to set.
     * @return the RackInner object itself.
     */
    public RackInner withRackSerialNumber(String rackSerialNumber) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RackProperties();
        }
        this.innerProperties().withRackSerialNumber(rackSerialNumber);
        return this;
    }

    /**
     * Get the rackSkuId property: The SKU for the rack.
     *
     * @return the rackSkuId value.
     */
    public String rackSkuId() {
        return this.innerProperties() == null ? null : this.innerProperties().rackSkuId();
    }

    /**
     * Set the rackSkuId property: The SKU for the rack.
     *
     * @param rackSkuId the rackSkuId value to set.
     * @return the RackInner object itself.
     */
    public RackInner withRackSkuId(String rackSkuId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RackProperties();
        }
        this.innerProperties().withRackSkuId(rackSkuId);
        return this;
    }

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

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