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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagepool.models.Disk;
import com.azure.resourcemanager.storagepool.models.OperationalStatus;
import com.azure.resourcemanager.storagepool.models.ProvisioningStates;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Disk Pool response properties. */
@Fluent
public final class DiskPoolProperties {
    /*
     * State of the operation on the resource.
     */
    @JsonProperty(value = "provisioningState", required = true, access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningStates provisioningState;

    /*
     * Logical zone for Disk Pool resource; example: ["1"].
     */
    @JsonProperty(value = "availabilityZones", required = true)
    private List<String> availabilityZones;

    /*
     * Operational status of the Disk Pool.
     */
    @JsonProperty(value = "status", required = true)
    private OperationalStatus status;

    /*
     * List of Azure Managed Disks to attach to a Disk Pool.
     */
    @JsonProperty(value = "disks")
    private List<Disk> disks;

    /*
     * Azure Resource ID of a Subnet for the Disk Pool.
     */
    @JsonProperty(value = "subnetId", required = true)
    private String subnetId;

    /*
     * List of additional capabilities for Disk Pool.
     */
    @JsonProperty(value = "additionalCapabilities")
    private List<String> additionalCapabilities;

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

    /**
     * Get the provisioningState property: State of the operation on the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningStates provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
     *
     * @return the availabilityZones value.
     */
    public List<String> availabilityZones() {
        return this.availabilityZones;
    }

    /**
     * Set the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
     *
     * @param availabilityZones the availabilityZones value to set.
     * @return the DiskPoolProperties object itself.
     */
    public DiskPoolProperties withAvailabilityZones(List<String> availabilityZones) {
        this.availabilityZones = availabilityZones;
        return this;
    }

    /**
     * Get the status property: Operational status of the Disk Pool.
     *
     * @return the status value.
     */
    public OperationalStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Operational status of the Disk Pool.
     *
     * @param status the status value to set.
     * @return the DiskPoolProperties object itself.
     */
    public DiskPoolProperties withStatus(OperationalStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the disks property: List of Azure Managed Disks to attach to a Disk Pool.
     *
     * @return the disks value.
     */
    public List<Disk> disks() {
        return this.disks;
    }

    /**
     * Set the disks property: List of Azure Managed Disks to attach to a Disk Pool.
     *
     * @param disks the disks value to set.
     * @return the DiskPoolProperties object itself.
     */
    public DiskPoolProperties withDisks(List<Disk> disks) {
        this.disks = disks;
        return this;
    }

    /**
     * Get the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
     *
     * @return the subnetId value.
     */
    public String subnetId() {
        return this.subnetId;
    }

    /**
     * Set the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
     *
     * @param subnetId the subnetId value to set.
     * @return the DiskPoolProperties object itself.
     */
    public DiskPoolProperties withSubnetId(String subnetId) {
        this.subnetId = subnetId;
        return this;
    }

    /**
     * Get the additionalCapabilities property: List of additional capabilities for Disk Pool.
     *
     * @return the additionalCapabilities value.
     */
    public List<String> additionalCapabilities() {
        return this.additionalCapabilities;
    }

    /**
     * Set the additionalCapabilities property: List of additional capabilities for Disk Pool.
     *
     * @param additionalCapabilities the additionalCapabilities value to set.
     * @return the DiskPoolProperties object itself.
     */
    public DiskPoolProperties withAdditionalCapabilities(List<String> additionalCapabilities) {
        this.additionalCapabilities = additionalCapabilities;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (availabilityZones() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property availabilityZones in model DiskPoolProperties"));
        }
        if (status() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property status in model DiskPoolProperties"));
        }
        if (disks() != null) {
            disks().forEach(e -> e.validate());
        }
        if (subnetId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property subnetId in model DiskPoolProperties"));
        }
    }

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