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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagepool.fluent.models.DiskPoolCreateProperties;
import com.azure.resourcemanager.storagepool.fluent.models.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Request payload for create or update Disk Pool request. */
@Fluent
public final class DiskPoolCreate extends Resource {
    /*
     * Determines the SKU of the Disk Pool
     */
    @JsonProperty(value = "sku", required = true)
    private Sku sku;

    /*
     * Properties for Disk Pool create request.
     */
    @JsonProperty(value = "properties", required = true)
    private DiskPoolCreateProperties innerProperties = new DiskPoolCreateProperties();

    /*
     * Azure resource id. Indicates if this resource is managed by another Azure resource.
     */
    @JsonProperty(value = "managedBy")
    private String managedBy;

    /*
     * List of Azure resource ids that manage this resource.
     */
    @JsonProperty(value = "managedByExtended")
    private List<String> managedByExtended;

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

    /**
     * Get the sku property: Determines the SKU of the Disk Pool.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Determines the SKU of the Disk Pool.
     *
     * @param sku the sku value to set.
     * @return the DiskPoolCreate object itself.
     */
    public DiskPoolCreate withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties for Disk Pool create request.
     *
     * @return the innerProperties value.
     */
    private DiskPoolCreateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
     *
     * @return the managedBy value.
     */
    public String managedBy() {
        return this.managedBy;
    }

    /**
     * Set the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
     *
     * @param managedBy the managedBy value to set.
     * @return the DiskPoolCreate object itself.
     */
    public DiskPoolCreate withManagedBy(String managedBy) {
        this.managedBy = managedBy;
        return this;
    }

    /**
     * Get the managedByExtended property: List of Azure resource ids that manage this resource.
     *
     * @return the managedByExtended value.
     */
    public List<String> managedByExtended() {
        return this.managedByExtended;
    }

    /**
     * Set the managedByExtended property: List of Azure resource ids that manage this resource.
     *
     * @param managedByExtended the managedByExtended value to set.
     * @return the DiskPoolCreate object itself.
     */
    public DiskPoolCreate withManagedByExtended(List<String> managedByExtended) {
        this.managedByExtended = managedByExtended;
        return this;
    }

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

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

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

    /**
     * Set the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
     *
     * @param availabilityZones the availabilityZones value to set.
     * @return the DiskPoolCreate object itself.
     */
    public DiskPoolCreate withAvailabilityZones(List<String> availabilityZones) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolCreateProperties();
        }
        this.innerProperties().withAvailabilityZones(availabilityZones);
        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.innerProperties() == null ? null : this.innerProperties().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 DiskPoolCreate object itself.
     */
    public DiskPoolCreate withDisks(List<Disk> disks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolCreateProperties();
        }
        this.innerProperties().withDisks(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.innerProperties() == null ? null : this.innerProperties().subnetId();
    }

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

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

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

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

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