// 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.ServerRole;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Represents a server in a cluster. */
@Fluent
public final class ClusterServerInner extends ProxyResource {
    /*
     * The properties of a server in a cluster.
     */
    @JsonProperty(value = "properties")
    private ClusterServerProperties 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 ClusterServerInner class. */
    public ClusterServerInner() {
    }

    /**
     * Get the innerProperties property: The properties of a server in a cluster.
     *
     * @return the innerProperties value.
     */
    private ClusterServerProperties 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 fullyQualifiedDomainName property: The fully qualified domain name of a server.
     *
     * @return the fullyQualifiedDomainName value.
     */
    public String fullyQualifiedDomainName() {
        return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName();
    }

    /**
     * Get the role property: The role of server in the cluster.
     *
     * @return the role value.
     */
    public ServerRole role() {
        return this.innerProperties() == null ? null : this.innerProperties().role();
    }

    /**
     * Set the role property: The role of server in the cluster.
     *
     * @param role the role value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withRole(ServerRole role) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withRole(role);
        return this;
    }

    /**
     * Get the state property: A state of a cluster/server that is visible to user.
     *
     * @return the state value.
     */
    public String state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Get the haState property: A state of HA feature for the cluster.
     *
     * @return the haState value.
     */
    public String haState() {
        return this.innerProperties() == null ? null : this.innerProperties().haState();
    }

    /**
     * Get the availabilityZone property: Availability Zone information of the server.
     *
     * @return the availabilityZone value.
     */
    public String availabilityZone() {
        return this.innerProperties() == null ? null : this.innerProperties().availabilityZone();
    }

    /**
     * Set the availabilityZone property: Availability Zone information of the server.
     *
     * @param availabilityZone the availabilityZone value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withAvailabilityZone(String availabilityZone) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withAvailabilityZone(availabilityZone);
        return this;
    }

    /**
     * Get the postgresqlVersion property: The major PostgreSQL version of server.
     *
     * @return the postgresqlVersion value.
     */
    public String postgresqlVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion();
    }

    /**
     * Set the postgresqlVersion property: The major PostgreSQL version of server.
     *
     * @param postgresqlVersion the postgresqlVersion value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withPostgresqlVersion(String postgresqlVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withPostgresqlVersion(postgresqlVersion);
        return this;
    }

    /**
     * Get the citusVersion property: The Citus extension version of server.
     *
     * @return the citusVersion value.
     */
    public String citusVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().citusVersion();
    }

    /**
     * Set the citusVersion property: The Citus extension version of server.
     *
     * @param citusVersion the citusVersion value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withCitusVersion(String citusVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withCitusVersion(citusVersion);
        return this;
    }

    /**
     * Get the serverEdition property: The edition of a server.
     *
     * @return the serverEdition value.
     */
    public String serverEdition() {
        return this.innerProperties() == null ? null : this.innerProperties().serverEdition();
    }

    /**
     * Set the serverEdition property: The edition of a server.
     *
     * @param serverEdition the serverEdition value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withServerEdition(String serverEdition) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withServerEdition(serverEdition);
        return this;
    }

    /**
     * Get the storageQuotaInMb property: The storage of a server in MB.
     *
     * @return the storageQuotaInMb value.
     */
    public Integer storageQuotaInMb() {
        return this.innerProperties() == null ? null : this.innerProperties().storageQuotaInMb();
    }

    /**
     * Set the storageQuotaInMb property: The storage of a server in MB.
     *
     * @param storageQuotaInMb the storageQuotaInMb value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withStorageQuotaInMb(Integer storageQuotaInMb) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withStorageQuotaInMb(storageQuotaInMb);
        return this;
    }

    /**
     * Get the vCores property: The vCores count of a server.
     *
     * @return the vCores value.
     */
    public Integer vCores() {
        return this.innerProperties() == null ? null : this.innerProperties().vCores();
    }

    /**
     * Set the vCores property: The vCores count of a server.
     *
     * @param vCores the vCores value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withVCores(Integer vCores) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withVCores(vCores);
        return this;
    }

    /**
     * Get the enableHa property: If high availability (HA) is enabled or not for the server.
     *
     * @return the enableHa value.
     */
    public Boolean enableHa() {
        return this.innerProperties() == null ? null : this.innerProperties().enableHa();
    }

    /**
     * Set the enableHa property: If high availability (HA) is enabled or not for the server.
     *
     * @param enableHa the enableHa value to set.
     * @return the ClusterServerInner object itself.
     */
    public ClusterServerInner withEnableHa(Boolean enableHa) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterServerProperties();
        }
        this.innerProperties().withEnableHa(enableHa);
        return this;
    }

    /**
     * Get the enablePublicIpAccess property: If public access is enabled on server.
     *
     * @return the enablePublicIpAccess value.
     */
    public Boolean enablePublicIpAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().enablePublicIpAccess();
    }

    /**
     * Get the isReadOnly property: If server database is set to read-only by system maintenance depending on high disk
     * space usage.
     *
     * @return the isReadOnly value.
     */
    public Boolean isReadOnly() {
        return this.innerProperties() == null ? null : this.innerProperties().isReadOnly();
    }

    /**
     * Get the administratorLogin property: The administrator's login name of the servers in the cluster.
     *
     * @return the administratorLogin value.
     */
    public String administratorLogin() {
        return this.innerProperties() == null ? null : this.innerProperties().administratorLogin();
    }

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