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

package com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The properties of a cluster role. */
@Fluent
public final class RoleProperties {
    /*
     * The password of the cluster role.
     */
    @JsonProperty(value = "password", required = true)
    private String password;

    /*
     * Provisioning state of the role
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the password property: The password of the cluster role.
     *
     * @return the password value.
     */
    public String password() {
        return this.password;
    }

    /**
     * Set the password property: The password of the cluster role.
     *
     * @param password the password value to set.
     * @return the RoleProperties object itself.
     */
    public RoleProperties withPassword(String password) {
        this.password = password;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the role.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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