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

package com.azure.resourcemanager.machinelearning.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;
import java.util.Map;

/** Azure Data Lake Gen1 datastore configuration. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "datastoreType")
@JsonTypeName("AzureDataLakeGen1")
@Fluent
public final class AzureDataLakeGen1Datastore extends DatastoreProperties {
    /*
     * Indicates which identity to use to authenticate service data access to customer's storage.
     */
    @JsonProperty(value = "serviceDataAccessAuthIdentity")
    private ServiceDataAccessAuthIdentity serviceDataAccessAuthIdentity;

    /*
     * [Required] Azure Data Lake store name.
     */
    @JsonProperty(value = "storeName", required = true)
    private String storeName;

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

    /**
     * Get the serviceDataAccessAuthIdentity property: Indicates which identity to use to authenticate service data
     * access to customer's storage.
     *
     * @return the serviceDataAccessAuthIdentity value.
     */
    public ServiceDataAccessAuthIdentity serviceDataAccessAuthIdentity() {
        return this.serviceDataAccessAuthIdentity;
    }

    /**
     * Set the serviceDataAccessAuthIdentity property: Indicates which identity to use to authenticate service data
     * access to customer's storage.
     *
     * @param serviceDataAccessAuthIdentity the serviceDataAccessAuthIdentity value to set.
     * @return the AzureDataLakeGen1Datastore object itself.
     */
    public AzureDataLakeGen1Datastore withServiceDataAccessAuthIdentity(
        ServiceDataAccessAuthIdentity serviceDataAccessAuthIdentity) {
        this.serviceDataAccessAuthIdentity = serviceDataAccessAuthIdentity;
        return this;
    }

    /**
     * Get the storeName property: [Required] Azure Data Lake store name.
     *
     * @return the storeName value.
     */
    public String storeName() {
        return this.storeName;
    }

    /**
     * Set the storeName property: [Required] Azure Data Lake store name.
     *
     * @param storeName the storeName value to set.
     * @return the AzureDataLakeGen1Datastore object itself.
     */
    public AzureDataLakeGen1Datastore withStoreName(String storeName) {
        this.storeName = storeName;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureDataLakeGen1Datastore withCredentials(DatastoreCredentials credentials) {
        super.withCredentials(credentials);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureDataLakeGen1Datastore withDescription(String description) {
        super.withDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureDataLakeGen1Datastore withProperties(Map<String, String> properties) {
        super.withProperties(properties);
        return this;
    }

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

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

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