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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.mysqlflexibleserver.models.Backup;
import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow;
import com.azure.resourcemanager.mysqlflexibleserver.models.Network;
import com.azure.resourcemanager.mysqlflexibleserver.models.ReplicationRole;
import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion;
import com.azure.resourcemanager.mysqlflexibleserver.models.Storage;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The properties that can be updated for a server. */
@Fluent
public final class ServerPropertiesForUpdate {
    /*
     * The password of the administrator login.
     */
    @JsonProperty(value = "administratorLoginPassword")
    private String administratorLoginPassword;

    /*
     * Server version.
     */
    @JsonProperty(value = "version")
    private ServerVersion version;

    /*
     * Storage related properties of a server.
     */
    @JsonProperty(value = "storage")
    private Storage storage;

    /*
     * Backup related properties of a server.
     */
    @JsonProperty(value = "backup")
    private Backup backup;

    /*
     * High availability related properties of a server.
     */
    @JsonProperty(value = "highAvailability")
    private HighAvailability highAvailability;

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

    /*
     * The replication role of the server.
     */
    @JsonProperty(value = "replicationRole")
    private ReplicationRole replicationRole;

    /*
     * The Data Encryption for CMK.
     */
    @JsonProperty(value = "dataEncryption")
    private DataEncryption dataEncryption;

    /*
     * Network related properties of a server
     */
    @JsonProperty(value = "network")
    private Network network;

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

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

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

    /**
     * Get the version property: Server version.
     *
     * @return the version value.
     */
    public ServerVersion version() {
        return this.version;
    }

    /**
     * Set the version property: Server version.
     *
     * @param version the version value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withVersion(ServerVersion version) {
        this.version = version;
        return this;
    }

    /**
     * Get the storage property: Storage related properties of a server.
     *
     * @return the storage value.
     */
    public Storage storage() {
        return this.storage;
    }

    /**
     * Set the storage property: Storage related properties of a server.
     *
     * @param storage the storage value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withStorage(Storage storage) {
        this.storage = storage;
        return this;
    }

    /**
     * Get the backup property: Backup related properties of a server.
     *
     * @return the backup value.
     */
    public Backup backup() {
        return this.backup;
    }

    /**
     * Set the backup property: Backup related properties of a server.
     *
     * @param backup the backup value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withBackup(Backup backup) {
        this.backup = backup;
        return this;
    }

    /**
     * Get the highAvailability property: High availability related properties of a server.
     *
     * @return the highAvailability value.
     */
    public HighAvailability highAvailability() {
        return this.highAvailability;
    }

    /**
     * Set the highAvailability property: High availability related properties of a server.
     *
     * @param highAvailability the highAvailability value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withHighAvailability(HighAvailability highAvailability) {
        this.highAvailability = highAvailability;
        return this;
    }

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

    /**
     * Set the maintenanceWindow property: Maintenance window of a server.
     *
     * @param maintenanceWindow the maintenanceWindow value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) {
        this.maintenanceWindow = maintenanceWindow;
        return this;
    }

    /**
     * Get the replicationRole property: The replication role of the server.
     *
     * @return the replicationRole value.
     */
    public ReplicationRole replicationRole() {
        return this.replicationRole;
    }

    /**
     * Set the replicationRole property: The replication role of the server.
     *
     * @param replicationRole the replicationRole value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withReplicationRole(ReplicationRole replicationRole) {
        this.replicationRole = replicationRole;
        return this;
    }

    /**
     * Get the dataEncryption property: The Data Encryption for CMK.
     *
     * @return the dataEncryption value.
     */
    public DataEncryption dataEncryption() {
        return this.dataEncryption;
    }

    /**
     * Set the dataEncryption property: The Data Encryption for CMK.
     *
     * @param dataEncryption the dataEncryption value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withDataEncryption(DataEncryption dataEncryption) {
        this.dataEncryption = dataEncryption;
        return this;
    }

    /**
     * Get the network property: Network related properties of a server.
     *
     * @return the network value.
     */
    public Network network() {
        return this.network;
    }

    /**
     * Set the network property: Network related properties of a server.
     *
     * @param network the network value to set.
     * @return the ServerPropertiesForUpdate object itself.
     */
    public ServerPropertiesForUpdate withNetwork(Network network) {
        this.network = network;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (storage() != null) {
            storage().validate();
        }
        if (backup() != null) {
            backup().validate();
        }
        if (highAvailability() != null) {
            highAvailability().validate();
        }
        if (maintenanceWindow() != null) {
            maintenanceWindow().validate();
        }
        if (dataEncryption() != null) {
            dataEncryption().validate();
        }
        if (network() != null) {
            network().validate();
        }
    }
}
