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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The policy assignment. */
@Fluent
public final class PolicyAssignmentInner extends ProxyResource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyAssignmentInner.class);

    /*
     * Properties for the policy assignment.
     */
    @JsonProperty(value = "properties")
    private PolicyAssignmentProperties innerProperties;

    /*
     * The type of the policy assignment.
     */
    @JsonProperty(value = "type")
    private String type;

    /*
     * The name of the policy assignment.
     */
    @JsonProperty(value = "name")
    private String name;

    /**
     * Get the innerProperties property: Properties for the policy assignment.
     *
     * @return the innerProperties value.
     */
    private PolicyAssignmentProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the policy assignment.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: The type of the policy assignment.
     *
     * @param type the type value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withType(String type) {
        this.type = type;
        return this;
    }

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

    /**
     * Set the name property: The name of the policy assignment.
     *
     * @param name the name value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the displayName property: The display name of the policy assignment.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Set the displayName property: The display name of the policy assignment.
     *
     * @param displayName the displayName value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyAssignmentProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

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

    /**
     * Set the policyDefinitionId property: The ID of the policy definition.
     *
     * @param policyDefinitionId the policyDefinitionId value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withPolicyDefinitionId(String policyDefinitionId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyAssignmentProperties();
        }
        this.innerProperties().withPolicyDefinitionId(policyDefinitionId);
        return this;
    }

    /**
     * Get the scope property: The scope for the policy assignment.
     *
     * @return the scope value.
     */
    public String scope() {
        return this.innerProperties() == null ? null : this.innerProperties().scope();
    }

    /**
     * Set the scope property: The scope for the policy assignment.
     *
     * @param scope the scope value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withScope(String scope) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyAssignmentProperties();
        }
        this.innerProperties().withScope(scope);
        return this;
    }

    /**
     * Get the parameters property: Required if a parameter is used in policy rule.
     *
     * @return the parameters value.
     */
    public Object parameters() {
        return this.innerProperties() == null ? null : this.innerProperties().parameters();
    }

    /**
     * Set the parameters property: Required if a parameter is used in policy rule.
     *
     * @param parameters the parameters value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withParameters(Object parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyAssignmentProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

    /**
     * Get the description property: This message will be part of response in case of policy violation.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: This message will be part of response in case of policy violation.
     *
     * @param description the description value to set.
     * @return the PolicyAssignmentInner object itself.
     */
    public PolicyAssignmentInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyAssignmentProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

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