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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.videoanalyzer.models.AccessPolicyRole;
import com.azure.resourcemanager.videoanalyzer.models.AuthenticationBase;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Access policies help define the authentication rules, and control access to specific video resources. */
@Fluent
public final class AccessPolicyEntityInner extends ProxyResource {
    /*
     * The resource properties.
     */
    @JsonProperty(value = "properties")
    private AccessPolicyProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy
     * information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the innerProperties property: The resource properties.
     *
     * @return the innerProperties value.
     */
    private AccessPolicyProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the role property: Defines the access level granted by this policy.
     *
     * @return the role value.
     */
    public AccessPolicyRole role() {
        return this.innerProperties() == null ? null : this.innerProperties().role();
    }

    /**
     * Set the role property: Defines the access level granted by this policy.
     *
     * @param role the role value to set.
     * @return the AccessPolicyEntityInner object itself.
     */
    public AccessPolicyEntityInner withRole(AccessPolicyRole role) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AccessPolicyProperties();
        }
        this.innerProperties().withRole(role);
        return this;
    }

    /**
     * Get the authentication property: Authentication method to be used when validating client API access.
     *
     * @return the authentication value.
     */
    public AuthenticationBase authentication() {
        return this.innerProperties() == null ? null : this.innerProperties().authentication();
    }

    /**
     * Set the authentication property: Authentication method to be used when validating client API access.
     *
     * @param authentication the authentication value to set.
     * @return the AccessPolicyEntityInner object itself.
     */
    public AccessPolicyEntityInner withAuthentication(AuthenticationBase authentication) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AccessPolicyProperties();
        }
        this.innerProperties().withAuthentication(authentication);
        return this;
    }

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