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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ConfigurationDataType;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ProvisioningState;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRoleGroupConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Represents configuration details for coordinator and node. */
@Fluent
public final class ConfigurationInner extends ProxyResource {
    /*
     * The properties of configuration.
     */
    @JsonProperty(value = "properties")
    private ConfigurationProperties innerProperties;

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

    /** Creates an instance of ConfigurationInner class. */
    public ConfigurationInner() {
    }

    /**
     * Get the innerProperties property: The properties of configuration.
     *
     * @return the innerProperties value.
     */
    private ConfigurationProperties 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 description property: Description of the configuration.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Get the dataType property: Data type of the configuration.
     *
     * @return the dataType value.
     */
    public ConfigurationDataType dataType() {
        return this.innerProperties() == null ? null : this.innerProperties().dataType();
    }

    /**
     * Get the allowedValues property: Allowed values of the configuration.
     *
     * @return the allowedValues value.
     */
    public String allowedValues() {
        return this.innerProperties() == null ? null : this.innerProperties().allowedValues();
    }

    /**
     * Get the requiresRestart property: If configuration change requires restart.
     *
     * @return the requiresRestart value.
     */
    public Boolean requiresRestart() {
        return this.innerProperties() == null ? null : this.innerProperties().requiresRestart();
    }

    /**
     * Set the requiresRestart property: If configuration change requires restart.
     *
     * @param requiresRestart the requiresRestart value to set.
     * @return the ConfigurationInner object itself.
     */
    public ConfigurationInner withRequiresRestart(Boolean requiresRestart) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConfigurationProperties();
        }
        this.innerProperties().withRequiresRestart(requiresRestart);
        return this;
    }

    /**
     * Get the serverRoleGroupConfigurations property: The list of server role group configuration values.
     *
     * @return the serverRoleGroupConfigurations value.
     */
    public List<ServerRoleGroupConfiguration> serverRoleGroupConfigurations() {
        return this.innerProperties() == null ? null : this.innerProperties().serverRoleGroupConfigurations();
    }

    /**
     * Set the serverRoleGroupConfigurations property: The list of server role group configuration values.
     *
     * @param serverRoleGroupConfigurations the serverRoleGroupConfigurations value to set.
     * @return the ConfigurationInner object itself.
     */
    public ConfigurationInner withServerRoleGroupConfigurations(
        List<ServerRoleGroupConfiguration> serverRoleGroupConfigurations) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConfigurationProperties();
        }
        this.innerProperties().withServerRoleGroupConfigurations(serverRoleGroupConfigurations);
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the configuration.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

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