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

package com.azure.resourcemanager.datalakestore.models;

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

/** The parameters used to update a trusted identity provider while updating a Data Lake Store account. */
@Fluent
public final class UpdateTrustedIdProviderWithAccountParameters {
    /*
     * The unique name of the trusted identity provider to update.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The trusted identity provider properties to use when updating a trusted identity provider.
     */
    @JsonProperty(value = "properties")
    private UpdateTrustedIdProviderProperties innerProperties;

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

    /**
     * Get the name property: The unique name of the trusted identity provider to update.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The unique name of the trusted identity provider to update.
     *
     * @param name the name value to set.
     * @return the UpdateTrustedIdProviderWithAccountParameters object itself.
     */
    public UpdateTrustedIdProviderWithAccountParameters withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the innerProperties property: The trusted identity provider properties to use when updating a trusted
     * identity provider.
     *
     * @return the innerProperties value.
     */
    private UpdateTrustedIdProviderProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the idProvider property: The URL of this trusted identity provider.
     *
     * @return the idProvider value.
     */
    public String idProvider() {
        return this.innerProperties() == null ? null : this.innerProperties().idProvider();
    }

    /**
     * Set the idProvider property: The URL of this trusted identity provider.
     *
     * @param idProvider the idProvider value to set.
     * @return the UpdateTrustedIdProviderWithAccountParameters object itself.
     */
    public UpdateTrustedIdProviderWithAccountParameters withIdProvider(String idProvider) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateTrustedIdProviderProperties();
        }
        this.innerProperties().withIdProvider(idProvider);
        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 UpdateTrustedIdProviderWithAccountParameters"));
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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