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

package com.azure.resourcemanager.cosmos.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.cosmos.fluent.models.MongoUserDefinitionResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Parameters to create and update an Azure Cosmos DB Mongo User Definition. */
@Fluent
public final class MongoUserDefinitionCreateUpdateParameters {
    /*
     * Properties to create and update an Azure Cosmos DB Mongo User Definition.
     */
    @JsonProperty(value = "properties")
    private MongoUserDefinitionResource innerProperties;

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

    /**
     * Get the innerProperties property: Properties to create and update an Azure Cosmos DB Mongo User Definition.
     *
     * @return the innerProperties value.
     */
    private MongoUserDefinitionResource innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the username property: The user name for User Definition.
     *
     * @return the username value.
     */
    public String username() {
        return this.innerProperties() == null ? null : this.innerProperties().username();
    }

    /**
     * Set the username property: The user name for User Definition.
     *
     * @param username the username value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withUsername(String username) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withUsername(username);
        return this;
    }

    /**
     * Get the password property: The password for User Definition. Response does not contain user password.
     *
     * @return the password value.
     */
    public String password() {
        return this.innerProperties() == null ? null : this.innerProperties().password();
    }

    /**
     * Set the password property: The password for User Definition. Response does not contain user password.
     *
     * @param password the password value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withPassword(String password) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withPassword(password);
        return this;
    }

    /**
     * Get the databaseName property: The database name for which access is being granted for this User Definition.
     *
     * @return the databaseName value.
     */
    public String databaseName() {
        return this.innerProperties() == null ? null : this.innerProperties().databaseName();
    }

    /**
     * Set the databaseName property: The database name for which access is being granted for this User Definition.
     *
     * @param databaseName the databaseName value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withDatabaseName(String databaseName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withDatabaseName(databaseName);
        return this;
    }

    /**
     * Get the customData property: A custom definition for the USer Definition.
     *
     * @return the customData value.
     */
    public String customData() {
        return this.innerProperties() == null ? null : this.innerProperties().customData();
    }

    /**
     * Set the customData property: A custom definition for the USer Definition.
     *
     * @param customData the customData value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withCustomData(String customData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withCustomData(customData);
        return this;
    }

    /**
     * Get the roles property: The set of roles inherited by the User Definition.
     *
     * @return the roles value.
     */
    public List<Role> roles() {
        return this.innerProperties() == null ? null : this.innerProperties().roles();
    }

    /**
     * Set the roles property: The set of roles inherited by the User Definition.
     *
     * @param roles the roles value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withRoles(List<Role> roles) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withRoles(roles);
        return this;
    }

    /**
     * Get the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.
     *
     * @return the mechanisms value.
     */
    public String mechanisms() {
        return this.innerProperties() == null ? null : this.innerProperties().mechanisms();
    }

    /**
     * Set the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.
     *
     * @param mechanisms the mechanisms value to set.
     * @return the MongoUserDefinitionCreateUpdateParameters object itself.
     */
    public MongoUserDefinitionCreateUpdateParameters withMechanisms(String mechanisms) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MongoUserDefinitionResource();
        }
        this.innerProperties().withMechanisms(mechanisms);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
