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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.apimanagement.models.PolicyContentFormat;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Policy Contract details. */
@Fluent
public final class PolicyContractInner extends ProxyResource {
    /*
     * Properties of the Policy.
     */
    @JsonProperty(value = "properties")
    private PolicyContractProperties innerProperties;

    /**
     * Get the innerProperties property: Properties of the Policy.
     *
     * @return the innerProperties value.
     */
    private PolicyContractProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the value property: Contents of the Policy as defined by the format.
     *
     * @return the value value.
     */
    public String value() {
        return this.innerProperties() == null ? null : this.innerProperties().value();
    }

    /**
     * Set the value property: Contents of the Policy as defined by the format.
     *
     * @param value the value value to set.
     * @return the PolicyContractInner object itself.
     */
    public PolicyContractInner withValue(String value) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyContractProperties();
        }
        this.innerProperties().withValue(value);
        return this;
    }

    /**
     * Get the format property: Format of the policyContent.
     *
     * @return the format value.
     */
    public PolicyContentFormat format() {
        return this.innerProperties() == null ? null : this.innerProperties().format();
    }

    /**
     * Set the format property: Format of the policyContent.
     *
     * @param format the format value to set.
     * @return the PolicyContractInner object itself.
     */
    public PolicyContractInner withFormat(PolicyContentFormat format) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PolicyContractProperties();
        }
        this.innerProperties().withFormat(format);
        return this;
    }

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