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

package com.azure.resourcemanager.databox.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Details of the managed disks. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "dataAccountType")
@JsonTypeName("ManagedDisk")
@Fluent
public final class ManagedDiskDetails extends DataAccountDetails {
    /*
     * Resource Group Id of the compute disks.
     */
    @JsonProperty(value = "resourceGroupId", required = true)
    private String resourceGroupId;

    /*
     * Resource Id of the storage account that can be used to copy the vhd for staging.
     */
    @JsonProperty(value = "stagingStorageAccountId", required = true)
    private String stagingStorageAccountId;

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

    /**
     * Get the resourceGroupId property: Resource Group Id of the compute disks.
     *
     * @return the resourceGroupId value.
     */
    public String resourceGroupId() {
        return this.resourceGroupId;
    }

    /**
     * Set the resourceGroupId property: Resource Group Id of the compute disks.
     *
     * @param resourceGroupId the resourceGroupId value to set.
     * @return the ManagedDiskDetails object itself.
     */
    public ManagedDiskDetails withResourceGroupId(String resourceGroupId) {
        this.resourceGroupId = resourceGroupId;
        return this;
    }

    /**
     * Get the stagingStorageAccountId property: Resource Id of the storage account that can be used to copy the vhd for
     * staging.
     *
     * @return the stagingStorageAccountId value.
     */
    public String stagingStorageAccountId() {
        return this.stagingStorageAccountId;
    }

    /**
     * Set the stagingStorageAccountId property: Resource Id of the storage account that can be used to copy the vhd for
     * staging.
     *
     * @param stagingStorageAccountId the stagingStorageAccountId value to set.
     * @return the ManagedDiskDetails object itself.
     */
    public ManagedDiskDetails withStagingStorageAccountId(String stagingStorageAccountId) {
        this.stagingStorageAccountId = stagingStorageAccountId;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ManagedDiskDetails withSharePassword(String sharePassword) {
        super.withSharePassword(sharePassword);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (resourceGroupId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property resourceGroupId in model ManagedDiskDetails"));
        }
        if (stagingStorageAccountId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property stagingStorageAccountId in model ManagedDiskDetails"));
        }
    }

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