// 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.Resource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.MaintenanceWindow;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerNameItem;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.SimplePrivateEndpointConnection;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** Represents a cluster. */
@Fluent
public final class ClusterInner extends Resource {
    /*
     * Properties of the cluster.
     */
    @JsonProperty(value = "properties")
    private ClusterProperties 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 ClusterInner class. */
    public ClusterInner() {
    }

    /**
     * Get the innerProperties property: Properties of the cluster.
     *
     * @return the innerProperties value.
     */
    private ClusterProperties 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;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * 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();
    }

    /**
     * Get the administratorLoginPassword property: The password of the administrator login. Required for creation.
     *
     * @return the administratorLoginPassword value.
     */
    public String administratorLoginPassword() {
        return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword();
    }

    /**
     * Set the administratorLoginPassword property: The password of the administrator login. Required for creation.
     *
     * @param administratorLoginPassword the administratorLoginPassword value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAdministratorLoginPassword(String administratorLoginPassword) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword);
        return this;
    }

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

    /**
     * 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 postgresqlVersion property: The major PostgreSQL version on all cluster servers.
     *
     * @return the postgresqlVersion value.
     */
    public String postgresqlVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion();
    }

    /**
     * Set the postgresqlVersion property: The major PostgreSQL version on all cluster servers.
     *
     * @param postgresqlVersion the postgresqlVersion value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withPostgresqlVersion(String postgresqlVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withPostgresqlVersion(postgresqlVersion);
        return this;
    }

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

    /**
     * Set the citusVersion property: The Citus extension version on all cluster servers.
     *
     * @param citusVersion the citusVersion value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withCitusVersion(String citusVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withCitusVersion(citusVersion);
        return this;
    }

    /**
     * Get the maintenanceWindow property: Maintenance window of a cluster.
     *
     * @return the maintenanceWindow value.
     */
    public MaintenanceWindow maintenanceWindow() {
        return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow();
    }

    /**
     * Set the maintenanceWindow property: Maintenance window of a cluster.
     *
     * @param maintenanceWindow the maintenanceWindow value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withMaintenanceWindow(maintenanceWindow);
        return this;
    }

    /**
     * Get the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers.
     *
     * @return the preferredPrimaryZone value.
     */
    public String preferredPrimaryZone() {
        return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone();
    }

    /**
     * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers.
     *
     * @param preferredPrimaryZone the preferredPrimaryZone value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withPreferredPrimaryZone(String preferredPrimaryZone) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withPreferredPrimaryZone(preferredPrimaryZone);
        return this;
    }

    /**
     * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster.
     *
     * @return the enableShardsOnCoordinator value.
     */
    public Boolean enableShardsOnCoordinator() {
        return this.innerProperties() == null ? null : this.innerProperties().enableShardsOnCoordinator();
    }

    /**
     * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster.
     *
     * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator);
        return this;
    }

    /**
     * Get the enableHa property: If high availability (HA) is enabled or not for the cluster.
     *
     * @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 cluster.
     *
     * @param enableHa the enableHa value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withEnableHa(Boolean enableHa) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withEnableHa(enableHa);
        return this;
    }

    /**
     * Get the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose).
     * Required for creation.
     *
     * @return the coordinatorServerEdition value.
     */
    public String coordinatorServerEdition() {
        return this.innerProperties() == null ? null : this.innerProperties().coordinatorServerEdition();
    }

    /**
     * Set the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose).
     * Required for creation.
     *
     * @param coordinatorServerEdition the coordinatorServerEdition value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withCoordinatorServerEdition(String coordinatorServerEdition) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withCoordinatorServerEdition(coordinatorServerEdition);
        return this;
    }

    /**
     * Get the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @return the coordinatorStorageQuotaInMb value.
     */
    public Integer coordinatorStorageQuotaInMb() {
        return this.innerProperties() == null ? null : this.innerProperties().coordinatorStorageQuotaInMb();
    }

    /**
     * Set the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb);
        return this;
    }

    /**
     * Get the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @return the coordinatorVCores value.
     */
    public Integer coordinatorVCores() {
        return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores();
    }

    /**
     * Set the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @param coordinatorVCores the coordinatorVCores value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withCoordinatorVCores(Integer coordinatorVCores) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withCoordinatorVCores(coordinatorVCores);
        return this;
    }

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

    /**
     * Set the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator.
     *
     * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess);
        return this;
    }

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

    /**
     * Set the nodeServerEdition property: The edition of a node server (default: MemoryOptimized).
     *
     * @param nodeServerEdition the nodeServerEdition value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNodeServerEdition(String nodeServerEdition) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNodeServerEdition(nodeServerEdition);
        return this;
    }

    /**
     * Get the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a single node
     * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent
     * multi-node configuration. Node count value cannot be 1. Required for creation.
     *
     * @return the nodeCount value.
     */
    public Integer nodeCount() {
        return this.innerProperties() == null ? null : this.innerProperties().nodeCount();
    }

    /**
     * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a single node
     * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent
     * multi-node configuration. Node count value cannot be 1. Required for creation.
     *
     * @param nodeCount the nodeCount value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNodeCount(Integer nodeCount) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNodeCount(nodeCount);
        return this;
    }

    /**
     * Get the nodeStorageQuotaInMb property: The storage in MB on each worker node. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @return the nodeStorageQuotaInMb value.
     */
    public Integer nodeStorageQuotaInMb() {
        return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb();
    }

    /**
     * Set the nodeStorageQuotaInMb property: The storage in MB on each worker node. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb);
        return this;
    }

    /**
     * Get the nodeVCores property: The compute in vCores on each worker node (max: 104). See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @return the nodeVCores value.
     */
    public Integer nodeVCores() {
        return this.innerProperties() == null ? null : this.innerProperties().nodeVCores();
    }

    /**
     * Set the nodeVCores property: The compute in vCores on each worker node (max: 104). See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     *
     * @param nodeVCores the nodeVCores value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNodeVCores(Integer nodeVCores) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNodeVCores(nodeVCores);
        return this;
    }

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

    /**
     * Set the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes.
     *
     * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNodeEnablePublicIpAccess(nodeEnablePublicIpAccess);
        return this;
    }

    /**
     * Get the serverNames property: The list of server names in the cluster.
     *
     * @return the serverNames value.
     */
    public List<ServerNameItem> serverNames() {
        return this.innerProperties() == null ? null : this.innerProperties().serverNames();
    }

    /**
     * Get the sourceResourceId property: The resource id of source cluster for read replica clusters.
     *
     * @return the sourceResourceId value.
     */
    public String sourceResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId();
    }

    /**
     * Set the sourceResourceId property: The resource id of source cluster for read replica clusters.
     *
     * @param sourceResourceId the sourceResourceId value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withSourceResourceId(String sourceResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withSourceResourceId(sourceResourceId);
        return this;
    }

    /**
     * Get the sourceLocation property: The Azure region of source cluster for read replica clusters.
     *
     * @return the sourceLocation value.
     */
    public String sourceLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceLocation();
    }

    /**
     * Set the sourceLocation property: The Azure region of source cluster for read replica clusters.
     *
     * @param sourceLocation the sourceLocation value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withSourceLocation(String sourceLocation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withSourceLocation(sourceLocation);
        return this;
    }

    /**
     * Get the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore.
     *
     * @return the pointInTimeUtc value.
     */
    public OffsetDateTime pointInTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().pointInTimeUtc();
    }

    /**
     * Set the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore.
     *
     * @param pointInTimeUtc the pointInTimeUtc value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withPointInTimeUtc(pointInTimeUtc);
        return this;
    }

    /**
     * Get the readReplicas property: The array of read replica clusters.
     *
     * @return the readReplicas value.
     */
    public List<String> readReplicas() {
        return this.innerProperties() == null ? null : this.innerProperties().readReplicas();
    }

    /**
     * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster.
     *
     * @return the earliestRestoreTime value.
     */
    public OffsetDateTime earliestRestoreTime() {
        return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreTime();
    }

    /**
     * Get the privateEndpointConnections property: The private endpoint connections for a cluster.
     *
     * @return the privateEndpointConnections value.
     */
    public List<SimplePrivateEndpointConnection> privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

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