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

package com.azure.resourcemanager.timeseriesinsights.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.timeseriesinsights.fluent.models.AccessPolicyMutableProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The AccessPolicyUpdateParameters model. */
@Fluent
public final class AccessPolicyUpdateParameters {
    /*
     * An object that represents a set of mutable access policy resource properties.
     */
    @JsonProperty(value = "properties")
    private AccessPolicyMutableProperties innerProperties;

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

    /**
     * Get the innerProperties property: An object that represents a set of mutable access policy resource properties.
     *
     * @return the innerProperties value.
     */
    private AccessPolicyMutableProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the description property: An description of the access policy.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: An description of the access policy.
     *
     * @param description the description value to set.
     * @return the AccessPolicyUpdateParameters object itself.
     */
    public AccessPolicyUpdateParameters withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AccessPolicyMutableProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the roles property: The list of roles the principal is assigned on the environment.
     *
     * @return the roles value.
     */
    public List<AccessPolicyRole> roles() {
        return this.innerProperties() == null ? null : this.innerProperties().roles();
    }

    /**
     * Set the roles property: The list of roles the principal is assigned on the environment.
     *
     * @param roles the roles value to set.
     * @return the AccessPolicyUpdateParameters object itself.
     */
    public AccessPolicyUpdateParameters withRoles(List<AccessPolicyRole> roles) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AccessPolicyMutableProperties();
        }
        this.innerProperties().withRoles(roles);
        return this;
    }

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