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

/** Properties of the cluster. */
@Fluent
public final class ClusterProperties {
    /*
     * The administrator's login name of the servers in the cluster.
     */
    @JsonProperty(value = "administratorLogin", access = JsonProperty.Access.WRITE_ONLY)
    private String administratorLogin;

    /*
     * The password of the administrator login. Required for creation.
     */
    @JsonProperty(value = "administratorLoginPassword")
    private String administratorLoginPassword;

    /*
     * Provisioning state of the cluster
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /*
     * A state of a cluster/server that is visible to user.
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private String state;

    /*
     * The major PostgreSQL version on all cluster servers.
     */
    @JsonProperty(value = "postgresqlVersion")
    private String postgresqlVersion;

    /*
     * The Citus extension version on all cluster servers.
     */
    @JsonProperty(value = "citusVersion")
    private String citusVersion;

    /*
     * Maintenance window of a cluster.
     */
    @JsonProperty(value = "maintenanceWindow")
    private MaintenanceWindow maintenanceWindow;

    /*
     * Preferred primary availability zone (AZ) for all cluster servers.
     */
    @JsonProperty(value = "preferredPrimaryZone")
    private String preferredPrimaryZone;

    /*
     * If shards on coordinator is enabled or not for the cluster.
     */
    @JsonProperty(value = "enableShardsOnCoordinator")
    private Boolean enableShardsOnCoordinator;

    /*
     * If high availability (HA) is enabled or not for the cluster.
     */
    @JsonProperty(value = "enableHa")
    private Boolean enableHa;

    /*
     * The edition of a coordinator server (default: GeneralPurpose). Required for creation.
     */
    @JsonProperty(value = "coordinatorServerEdition")
    private String coordinatorServerEdition;

    /*
     * The storage of a server in MB. Required for creation. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     */
    @JsonProperty(value = "coordinatorStorageQuotaInMb")
    private Integer coordinatorStorageQuotaInMb;

    /*
     * 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.
     */
    @JsonProperty(value = "coordinatorVCores")
    private Integer coordinatorVCores;

    /*
     * If public access is enabled on coordinator.
     */
    @JsonProperty(value = "coordinatorEnablePublicIpAccess")
    private Boolean coordinatorEnablePublicIpAccess;

    /*
     * The edition of a node server (default: MemoryOptimized).
     */
    @JsonProperty(value = "nodeServerEdition")
    private String nodeServerEdition;

    /*
     * 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.
     */
    @JsonProperty(value = "nodeCount")
    private Integer nodeCount;

    /*
     * The storage in MB on each worker node. See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     */
    @JsonProperty(value = "nodeStorageQuotaInMb")
    private Integer nodeStorageQuotaInMb;

    /*
     * The compute in vCores on each worker node (max: 104). See
     * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.
     */
    @JsonProperty(value = "nodeVCores")
    private Integer nodeVCores;

    /*
     * If public access is enabled on worker nodes.
     */
    @JsonProperty(value = "nodeEnablePublicIpAccess")
    private Boolean nodeEnablePublicIpAccess;

    /*
     * The list of server names in the cluster
     */
    @JsonProperty(value = "serverNames", access = JsonProperty.Access.WRITE_ONLY)
    private List<ServerNameItem> serverNames;

    /*
     * The resource id of source cluster for read replica clusters.
     */
    @JsonProperty(value = "sourceResourceId")
    private String sourceResourceId;

    /*
     * The Azure region of source cluster for read replica clusters.
     */
    @JsonProperty(value = "sourceLocation")
    private String sourceLocation;

    /*
     * Date and time in UTC (ISO8601 format) for cluster restore.
     */
    @JsonProperty(value = "pointInTimeUTC")
    private OffsetDateTime pointInTimeUtc;

    /*
     * The array of read replica clusters.
     */
    @JsonProperty(value = "readReplicas", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> readReplicas;

    /*
     * The earliest restore point time (ISO8601 format) for the cluster.
     */
    @JsonProperty(value = "earliestRestoreTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime earliestRestoreTime;

    /*
     * The private endpoint connections for a cluster.
     */
    @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY)
    private List<SimplePrivateEndpointConnection> privateEndpointConnections;

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

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

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

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

    /**
     * Get the provisioningState property: Provisioning state of the cluster.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.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.state;
    }

    /**
     * Get the postgresqlVersion property: The major PostgreSQL version on all cluster servers.
     *
     * @return the postgresqlVersion value.
     */
    public String postgresqlVersion() {
        return this.postgresqlVersion;
    }

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

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

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

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

    /**
     * Set the maintenanceWindow property: Maintenance window of a cluster.
     *
     * @param maintenanceWindow the maintenanceWindow value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) {
        this.maintenanceWindow = 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.preferredPrimaryZone;
    }

    /**
     * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers.
     *
     * @param preferredPrimaryZone the preferredPrimaryZone value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withPreferredPrimaryZone(String preferredPrimaryZone) {
        this.preferredPrimaryZone = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) {
        this.enableShardsOnCoordinator = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withEnableHa(Boolean enableHa) {
        this.enableHa = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withCoordinatorServerEdition(String coordinatorServerEdition) {
        this.coordinatorServerEdition = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb) {
        this.coordinatorStorageQuotaInMb = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withCoordinatorVCores(Integer coordinatorVCores) {
        this.coordinatorVCores = coordinatorVCores;
        return this;
    }

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

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

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

    /**
     * Set the nodeServerEdition property: The edition of a node server (default: MemoryOptimized).
     *
     * @param nodeServerEdition the nodeServerEdition value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withNodeServerEdition(String nodeServerEdition) {
        this.nodeServerEdition = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withNodeCount(Integer nodeCount) {
        this.nodeCount = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) {
        this.nodeStorageQuotaInMb = 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.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 ClusterProperties object itself.
     */
    public ClusterProperties withNodeVCores(Integer nodeVCores) {
        this.nodeVCores = nodeVCores;
        return this;
    }

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

    /**
     * Set the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes.
     *
     * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) {
        this.nodeEnablePublicIpAccess = 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.serverNames;
    }

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

    /**
     * Set the sourceResourceId property: The resource id of source cluster for read replica clusters.
     *
     * @param sourceResourceId the sourceResourceId value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withSourceResourceId(String sourceResourceId) {
        this.sourceResourceId = 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.sourceLocation;
    }

    /**
     * Set the sourceLocation property: The Azure region of source cluster for read replica clusters.
     *
     * @param sourceLocation the sourceLocation value to set.
     * @return the ClusterProperties object itself.
     */
    public ClusterProperties withSourceLocation(String sourceLocation) {
        this.sourceLocation = 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.pointInTimeUtc;
    }

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

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

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

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

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (maintenanceWindow() != null) {
            maintenanceWindow().validate();
        }
        if (serverNames() != null) {
            serverNames().forEach(e -> e.validate());
        }
        if (privateEndpointConnections() != null) {
            privateEndpointConnections().forEach(e -> e.validate());
        }
    }
}
