// 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.util.logging.ClientLogger;
import com.azure.resourcemanager.storagepool.fluent.models.DiskPoolUpdateProperties;
import com.azure.resourcemanager.storagepool.fluent.models.Sku;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Request payload for Update Disk Pool request. */
@Fluent
public final class DiskPoolUpdate {
    /*
     * 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;

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

    /*
     * Determines the SKU of the Disk Pool
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

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

    /**
     * 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 DiskPoolUpdate object itself.
     */
    public DiskPoolUpdate 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 DiskPoolUpdate object itself.
     */
    public DiskPoolUpdate withManagedByExtended(List<String> managedByExtended) {
        this.managedByExtended = managedByExtended;
        return this;
    }

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

    /**
     * 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 DiskPoolUpdate object itself.
     */
    public DiskPoolUpdate withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the DiskPoolUpdate object itself.
     */
    public DiskPoolUpdate withTags(Map<String, String> tags) {
        this.tags = tags;
        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 DiskPoolUpdate object itself.
     */
    public DiskPoolUpdate withDisks(List<Disk> disks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolUpdateProperties();
        }
        this.innerProperties().withDisks(disks);
        return this;
    }

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

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