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

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

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

/** AppRoleAssignment information. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType")
@JsonTypeName("AppRoleAssignment")
@Fluent
public final class AppRoleAssignmentInner extends DirectoryObjectInner {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(AppRoleAssignmentInner.class);

    /*
     * The role id that was assigned to the principal. This role must be
     * declared by the target resource application resourceId in its appRoles
     * property.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * The display name of the principal that was granted the access.
     */
    @JsonProperty(value = "principalDisplayName")
    private String principalDisplayName;

    /*
     * The unique identifier (objectId) for the principal being granted the
     * access.
     */
    @JsonProperty(value = "principalId")
    private String principalId;

    /*
     * The type of principal. This can either be "User", "Group" or
     * "ServicePrincipal".
     */
    @JsonProperty(value = "principalType")
    private String principalType;

    /*
     * The display name of the resource to which the assignment was made.
     */
    @JsonProperty(value = "resourceDisplayName")
    private String resourceDisplayName;

    /*
     * The unique identifier (objectId) for the target resource (service
     * principal) for which the assignment was made.
     */
    @JsonProperty(value = "resourceId")
    private String resourceId;

    /**
     * Get the id property: The role id that was assigned to the principal. This role must be declared by the target
     * resource application resourceId in its appRoles property.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: The role id that was assigned to the principal. This role must be declared by the target
     * resource application resourceId in its appRoles property.
     *
     * @param id the id value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the principalDisplayName property: The display name of the principal that was granted the access.
     *
     * @return the principalDisplayName value.
     */
    public String principalDisplayName() {
        return this.principalDisplayName;
    }

    /**
     * Set the principalDisplayName property: The display name of the principal that was granted the access.
     *
     * @param principalDisplayName the principalDisplayName value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withPrincipalDisplayName(String principalDisplayName) {
        this.principalDisplayName = principalDisplayName;
        return this;
    }

    /**
     * Get the principalId property: The unique identifier (objectId) for the principal being granted the access.
     *
     * @return the principalId value.
     */
    public String principalId() {
        return this.principalId;
    }

    /**
     * Set the principalId property: The unique identifier (objectId) for the principal being granted the access.
     *
     * @param principalId the principalId value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withPrincipalId(String principalId) {
        this.principalId = principalId;
        return this;
    }

    /**
     * Get the principalType property: The type of principal. This can either be "User", "Group" or "ServicePrincipal".
     *
     * @return the principalType value.
     */
    public String principalType() {
        return this.principalType;
    }

    /**
     * Set the principalType property: The type of principal. This can either be "User", "Group" or "ServicePrincipal".
     *
     * @param principalType the principalType value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withPrincipalType(String principalType) {
        this.principalType = principalType;
        return this;
    }

    /**
     * Get the resourceDisplayName property: The display name of the resource to which the assignment was made.
     *
     * @return the resourceDisplayName value.
     */
    public String resourceDisplayName() {
        return this.resourceDisplayName;
    }

    /**
     * Set the resourceDisplayName property: The display name of the resource to which the assignment was made.
     *
     * @param resourceDisplayName the resourceDisplayName value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withResourceDisplayName(String resourceDisplayName) {
        this.resourceDisplayName = resourceDisplayName;
        return this;
    }

    /**
     * Get the resourceId property: The unique identifier (objectId) for the target resource (service principal) for
     * which the assignment was made.
     *
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: The unique identifier (objectId) for the target resource (service principal) for
     * which the assignment was made.
     *
     * @param resourceId the resourceId value to set.
     * @return the AppRoleAssignmentInner object itself.
     */
    public AppRoleAssignmentInner withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
    }
}
