// 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.util.logging.ClientLogger;
import com.azure.resourcemanager.apimanagement.models.SchemaType;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Schema create or update contract Properties. */
@Fluent
public final class GlobalSchemaContractProperties {
    /*
     * Schema Type. Immutable.
     */
    @JsonProperty(value = "schemaType", required = true)
    private SchemaType schemaType;

    /*
     * Free-form schema entity description.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * Json-encoded string for non json-based schema.
     */
    @JsonProperty(value = "value")
    private Object value;

    /*
     * Global Schema document object for json-based schema formats(e.g. json
     * schema).
     */
    @JsonProperty(value = "document")
    private Object document;

    /**
     * Get the schemaType property: Schema Type. Immutable.
     *
     * @return the schemaType value.
     */
    public SchemaType schemaType() {
        return this.schemaType;
    }

    /**
     * Set the schemaType property: Schema Type. Immutable.
     *
     * @param schemaType the schemaType value to set.
     * @return the GlobalSchemaContractProperties object itself.
     */
    public GlobalSchemaContractProperties withSchemaType(SchemaType schemaType) {
        this.schemaType = schemaType;
        return this;
    }

    /**
     * Get the description property: Free-form schema entity description.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Free-form schema entity description.
     *
     * @param description the description value to set.
     * @return the GlobalSchemaContractProperties object itself.
     */
    public GlobalSchemaContractProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the value property: Json-encoded string for non json-based schema.
     *
     * @return the value value.
     */
    public Object value() {
        return this.value;
    }

    /**
     * Set the value property: Json-encoded string for non json-based schema.
     *
     * @param value the value value to set.
     * @return the GlobalSchemaContractProperties object itself.
     */
    public GlobalSchemaContractProperties withValue(Object value) {
        this.value = value;
        return this;
    }

    /**
     * Get the document property: Global Schema document object for json-based schema formats(e.g. json schema).
     *
     * @return the document value.
     */
    public Object document() {
        return this.document;
    }

    /**
     * Set the document property: Global Schema document object for json-based schema formats(e.g. json schema).
     *
     * @param document the document value to set.
     * @return the GlobalSchemaContractProperties object itself.
     */
    public GlobalSchemaContractProperties withDocument(Object document) {
        this.document = document;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (schemaType() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property schemaType in model GlobalSchemaContractProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(GlobalSchemaContractProperties.class);
}
