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

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

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The properties of the a role definition. */
@Fluent
public final class BillingRoleDefinitionProperties {
    /*
     * The role description
     */
    @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY)
    private String description;

    /*
     * The billingPermissions the role has
     */
    @JsonProperty(value = "permissions")
    private List<BillingPermissionsPropertiesInner> permissions;

    /*
     * The name of the role
     */
    @JsonProperty(value = "roleName", access = JsonProperty.Access.WRITE_ONLY)
    private String roleName;

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

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

    /**
     * Get the permissions property: The billingPermissions the role has.
     *
     * @return the permissions value.
     */
    public List<BillingPermissionsPropertiesInner> permissions() {
        return this.permissions;
    }

    /**
     * Set the permissions property: The billingPermissions the role has.
     *
     * @param permissions the permissions value to set.
     * @return the BillingRoleDefinitionProperties object itself.
     */
    public BillingRoleDefinitionProperties withPermissions(List<BillingPermissionsPropertiesInner> permissions) {
        this.permissions = permissions;
        return this;
    }

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

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