// 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 for the storage account. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "dataAccountType")
@JsonTypeName("StorageAccount")
@Fluent
public final class StorageAccountDetails extends DataAccountDetails {
    /*
     * Storage Account Resource Id.
     */
    @JsonProperty(value = "storageAccountId", required = true)
    private String storageAccountId;

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

    /**
     * Get the storageAccountId property: Storage Account Resource Id.
     *
     * @return the storageAccountId value.
     */
    public String storageAccountId() {
        return this.storageAccountId;
    }

    /**
     * Set the storageAccountId property: Storage Account Resource Id.
     *
     * @param storageAccountId the storageAccountId value to set.
     * @return the StorageAccountDetails object itself.
     */
    public StorageAccountDetails withStorageAccountId(String storageAccountId) {
        this.storageAccountId = storageAccountId;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public StorageAccountDetails 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 (storageAccountId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property storageAccountId in model StorageAccountDetails"));
        }
    }

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