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

package com.azure.resourcemanager.networkcloud.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * ServicePrincipalInformation represents the details of the service principal to be used by the cluster during Arc
 * Appliance installation.
 */
@Fluent
public final class ServicePrincipalInformation {
    /*
     * The application ID, also known as client ID, of the service principal.
     */
    @JsonProperty(value = "applicationId", required = true)
    private String applicationId;

    /*
     * The password of the service principal.
     */
    @JsonProperty(value = "password", required = true)
    private String password;

    /*
     * The principal ID, also known as the object ID, of the service principal.
     */
    @JsonProperty(value = "principalId", required = true)
    private String principalId;

    /*
     * The tenant ID, also known as the directory ID, of the tenant in which the service principal is created.
     */
    @JsonProperty(value = "tenantId", required = true)
    private String tenantId;

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

    /**
     * Get the applicationId property: The application ID, also known as client ID, of the service principal.
     *
     * @return the applicationId value.
     */
    public String applicationId() {
        return this.applicationId;
    }

    /**
     * Set the applicationId property: The application ID, also known as client ID, of the service principal.
     *
     * @param applicationId the applicationId value to set.
     * @return the ServicePrincipalInformation object itself.
     */
    public ServicePrincipalInformation withApplicationId(String applicationId) {
        this.applicationId = applicationId;
        return this;
    }

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

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

    /**
     * Get the principalId property: The principal ID, also known as the object ID, of the service principal.
     *
     * @return the principalId value.
     */
    public String principalId() {
        return this.principalId;
    }

    /**
     * Set the principalId property: The principal ID, also known as the object ID, of the service principal.
     *
     * @param principalId the principalId value to set.
     * @return the ServicePrincipalInformation object itself.
     */
    public ServicePrincipalInformation withPrincipalId(String principalId) {
        this.principalId = principalId;
        return this;
    }

    /**
     * Get the tenantId property: The tenant ID, also known as the directory ID, of the tenant in which the service
     * principal is created.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Set the tenantId property: The tenant ID, also known as the directory ID, of the tenant in which the service
     * principal is created.
     *
     * @param tenantId the tenantId value to set.
     * @return the ServicePrincipalInformation object itself.
     */
    public ServicePrincipalInformation withTenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

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

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