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

package com.azure.resourcemanager.providerhub.models;

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

/** The LightHouseAuthorization model. */
@Fluent
public final class LightHouseAuthorization {
    /*
     * The principalId property.
     */
    @JsonProperty(value = "principalId", required = true)
    private String principalId;

    /*
     * The roleDefinitionId property.
     */
    @JsonProperty(value = "roleDefinitionId", required = true)
    private String roleDefinitionId;

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

    /**
     * Get the principalId property: The principalId property.
     *
     * @return the principalId value.
     */
    public String principalId() {
        return this.principalId;
    }

    /**
     * Set the principalId property: The principalId property.
     *
     * @param principalId the principalId value to set.
     * @return the LightHouseAuthorization object itself.
     */
    public LightHouseAuthorization withPrincipalId(String principalId) {
        this.principalId = principalId;
        return this;
    }

    /**
     * Get the roleDefinitionId property: The roleDefinitionId property.
     *
     * @return the roleDefinitionId value.
     */
    public String roleDefinitionId() {
        return this.roleDefinitionId;
    }

    /**
     * Set the roleDefinitionId property: The roleDefinitionId property.
     *
     * @param roleDefinitionId the roleDefinitionId value to set.
     * @return the LightHouseAuthorization object itself.
     */
    public LightHouseAuthorization withRoleDefinitionId(String roleDefinitionId) {
        this.roleDefinitionId = roleDefinitionId;
        return this;
    }

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

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