// 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.apimanagement.fluent.models.NamedValueCreateContractProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** NamedValue details. */
@Fluent
public final class NamedValueCreateContract extends ProxyResource {
    /*
     * NamedValue entity contract properties for PUT operation.
     */
    @JsonProperty(value = "properties")
    private NamedValueCreateContractProperties innerProperties;

    /**
     * Get the innerProperties property: NamedValue entity contract properties for PUT operation.
     *
     * @return the innerProperties value.
     */
    private NamedValueCreateContractProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the displayName property: Unique name of NamedValue. It may contain only letters, digits, period, dash, and
     * underscore characters.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Set the displayName property: Unique name of NamedValue. It may contain only letters, digits, period, dash, and
     * underscore characters.
     *
     * @param displayName the displayName value to set.
     * @return the NamedValueCreateContract object itself.
     */
    public NamedValueCreateContract withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamedValueCreateContractProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the value property: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist
     * only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get
     * the value.
     *
     * @return the value value.
     */
    public String value() {
        return this.innerProperties() == null ? null : this.innerProperties().value();
    }

    /**
     * Set the value property: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist
     * only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get
     * the value.
     *
     * @param value the value value to set.
     * @return the NamedValueCreateContract object itself.
     */
    public NamedValueCreateContract withValue(String value) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamedValueCreateContractProperties();
        }
        this.innerProperties().withValue(value);
        return this;
    }

    /**
     * Get the keyVault property: KeyVault location details of the namedValue.
     *
     * @return the keyVault value.
     */
    public KeyVaultContractCreateProperties keyVault() {
        return this.innerProperties() == null ? null : this.innerProperties().keyVault();
    }

    /**
     * Set the keyVault property: KeyVault location details of the namedValue.
     *
     * @param keyVault the keyVault value to set.
     * @return the NamedValueCreateContract object itself.
     */
    public NamedValueCreateContract withKeyVault(KeyVaultContractCreateProperties keyVault) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamedValueCreateContractProperties();
        }
        this.innerProperties().withKeyVault(keyVault);
        return this;
    }

    /**
     * Get the tags property: Optional tags that when provided can be used to filter the NamedValue list.
     *
     * @return the tags value.
     */
    public List<String> tags() {
        return this.innerProperties() == null ? null : this.innerProperties().tags();
    }

    /**
     * Set the tags property: Optional tags that when provided can be used to filter the NamedValue list.
     *
     * @param tags the tags value to set.
     * @return the NamedValueCreateContract object itself.
     */
    public NamedValueCreateContract withTags(List<String> tags) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamedValueCreateContractProperties();
        }
        this.innerProperties().withTags(tags);
        return this;
    }

    /**
     * Get the secret property: Determines whether the value is a secret and should be encrypted or not. Default value
     * is false.
     *
     * @return the secret value.
     */
    public Boolean secret() {
        return this.innerProperties() == null ? null : this.innerProperties().secret();
    }

    /**
     * Set the secret property: Determines whether the value is a secret and should be encrypted or not. Default value
     * is false.
     *
     * @param secret the secret value to set.
     * @return the NamedValueCreateContract object itself.
     */
    public NamedValueCreateContract withSecret(Boolean secret) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamedValueCreateContractProperties();
        }
        this.innerProperties().withSecret(secret);
        return this;
    }

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