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

package com.azure.resourcemanager.datalakeanalytics.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datalakeanalytics.fluent.models.AddStorageAccountProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameters used to add a new Azure Storage account while creating a new Data Lake Analytics account. */
@Fluent
public final class AddStorageAccountWithAccountParameters {
    /*
     * The unique name of the Azure Storage account to add.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The Azure Storage account properties to use when adding a new Azure Storage account.
     */
    @JsonProperty(value = "properties", required = true)
    private AddStorageAccountProperties innerProperties = new AddStorageAccountProperties();

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

    /**
     * Get the name property: The unique name of the Azure Storage account to add.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The unique name of the Azure Storage account to add.
     *
     * @param name the name value to set.
     * @return the AddStorageAccountWithAccountParameters object itself.
     */
    public AddStorageAccountWithAccountParameters withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the innerProperties property: The Azure Storage account properties to use when adding a new Azure Storage
     * account.
     *
     * @return the innerProperties value.
     */
    private AddStorageAccountProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the accessKey property: The access key associated with this Azure Storage account that will be used to
     * connect to it.
     *
     * @return the accessKey value.
     */
    public String accessKey() {
        return this.innerProperties() == null ? null : this.innerProperties().accessKey();
    }

    /**
     * Set the accessKey property: The access key associated with this Azure Storage account that will be used to
     * connect to it.
     *
     * @param accessKey the accessKey value to set.
     * @return the AddStorageAccountWithAccountParameters object itself.
     */
    public AddStorageAccountWithAccountParameters withAccessKey(String accessKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AddStorageAccountProperties();
        }
        this.innerProperties().withAccessKey(accessKey);
        return this;
    }

    /**
     * Get the suffix property: The optional suffix for the storage account.
     *
     * @return the suffix value.
     */
    public String suffix() {
        return this.innerProperties() == null ? null : this.innerProperties().suffix();
    }

    /**
     * Set the suffix property: The optional suffix for the storage account.
     *
     * @param suffix the suffix value to set.
     * @return the AddStorageAccountWithAccountParameters object itself.
     */
    public AddStorageAccountWithAccountParameters withSuffix(String suffix) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AddStorageAccountProperties();
        }
        this.innerProperties().withSuffix(suffix);
        return this;
    }

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

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