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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.customerinsights.models.PermissionTypes;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The authorization policy resource format. */
@Fluent
public final class AuthorizationPolicyResourceFormatInner extends ProxyResource {
    /*
     * The authorization policy.
     */
    @JsonProperty(value = "properties")
    private AuthorizationPolicyInner innerProperties;

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

    /**
     * Get the innerProperties property: The authorization policy.
     *
     * @return the innerProperties value.
     */
    private AuthorizationPolicyInner innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Get the permissions property: The permissions associated with the policy.
     *
     * @return the permissions value.
     */
    public List<PermissionTypes> permissions() {
        return this.innerProperties() == null ? null : this.innerProperties().permissions();
    }

    /**
     * Set the permissions property: The permissions associated with the policy.
     *
     * @param permissions the permissions value to set.
     * @return the AuthorizationPolicyResourceFormatInner object itself.
     */
    public AuthorizationPolicyResourceFormatInner withPermissions(List<PermissionTypes> permissions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AuthorizationPolicyInner();
        }
        this.innerProperties().withPermissions(permissions);
        return this;
    }

    /**
     * Get the primaryKey property: Primary key associated with the policy.
     *
     * @return the primaryKey value.
     */
    public String primaryKey() {
        return this.innerProperties() == null ? null : this.innerProperties().primaryKey();
    }

    /**
     * Set the primaryKey property: Primary key associated with the policy.
     *
     * @param primaryKey the primaryKey value to set.
     * @return the AuthorizationPolicyResourceFormatInner object itself.
     */
    public AuthorizationPolicyResourceFormatInner withPrimaryKey(String primaryKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AuthorizationPolicyInner();
        }
        this.innerProperties().withPrimaryKey(primaryKey);
        return this;
    }

    /**
     * Get the secondaryKey property: Secondary key associated with the policy.
     *
     * @return the secondaryKey value.
     */
    public String secondaryKey() {
        return this.innerProperties() == null ? null : this.innerProperties().secondaryKey();
    }

    /**
     * Set the secondaryKey property: Secondary key associated with the policy.
     *
     * @param secondaryKey the secondaryKey value to set.
     * @return the AuthorizationPolicyResourceFormatInner object itself.
     */
    public AuthorizationPolicyResourceFormatInner withSecondaryKey(String secondaryKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AuthorizationPolicyInner();
        }
        this.innerProperties().withSecondaryKey(secondaryKey);
        return this;
    }

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