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

package com.azure.resourcemanager.datamigration.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Input for the task that gets TDE certificates in Base64 encoded format. */
@Fluent
public final class GetTdeCertificatesSqlTaskInput {
    /*
     * Connection information for SQL Server
     */
    @JsonProperty(value = "connectionInfo", required = true)
    private SqlConnectionInfo connectionInfo;

    /*
     * Backup file share information for file share to be used for temporarily storing files.
     */
    @JsonProperty(value = "backupFileShare", required = true)
    private FileShare backupFileShare;

    /*
     * List containing certificate names and corresponding password to use for encrypting the exported certificate.
     */
    @JsonProperty(value = "selectedCertificates", required = true)
    private List<SelectedCertificateInput> selectedCertificates;

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

    /**
     * Get the connectionInfo property: Connection information for SQL Server.
     *
     * @return the connectionInfo value.
     */
    public SqlConnectionInfo connectionInfo() {
        return this.connectionInfo;
    }

    /**
     * Set the connectionInfo property: Connection information for SQL Server.
     *
     * @param connectionInfo the connectionInfo value to set.
     * @return the GetTdeCertificatesSqlTaskInput object itself.
     */
    public GetTdeCertificatesSqlTaskInput withConnectionInfo(SqlConnectionInfo connectionInfo) {
        this.connectionInfo = connectionInfo;
        return this;
    }

    /**
     * Get the backupFileShare property: Backup file share information for file share to be used for temporarily storing
     * files.
     *
     * @return the backupFileShare value.
     */
    public FileShare backupFileShare() {
        return this.backupFileShare;
    }

    /**
     * Set the backupFileShare property: Backup file share information for file share to be used for temporarily storing
     * files.
     *
     * @param backupFileShare the backupFileShare value to set.
     * @return the GetTdeCertificatesSqlTaskInput object itself.
     */
    public GetTdeCertificatesSqlTaskInput withBackupFileShare(FileShare backupFileShare) {
        this.backupFileShare = backupFileShare;
        return this;
    }

    /**
     * Get the selectedCertificates property: List containing certificate names and corresponding password to use for
     * encrypting the exported certificate.
     *
     * @return the selectedCertificates value.
     */
    public List<SelectedCertificateInput> selectedCertificates() {
        return this.selectedCertificates;
    }

    /**
     * Set the selectedCertificates property: List containing certificate names and corresponding password to use for
     * encrypting the exported certificate.
     *
     * @param selectedCertificates the selectedCertificates value to set.
     * @return the GetTdeCertificatesSqlTaskInput object itself.
     */
    public GetTdeCertificatesSqlTaskInput withSelectedCertificates(
        List<SelectedCertificateInput> selectedCertificates) {
        this.selectedCertificates = selectedCertificates;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (connectionInfo() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property connectionInfo in model GetTdeCertificatesSqlTaskInput"));
        } else {
            connectionInfo().validate();
        }
        if (backupFileShare() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property backupFileShare in model GetTdeCertificatesSqlTaskInput"));
        } else {
            backupFileShare().validate();
        }
        if (selectedCertificates() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property selectedCertificates in model GetTdeCertificatesSqlTaskInput"));
        } else {
            selectedCertificates().forEach(e -> e.validate());
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(GetTdeCertificatesSqlTaskInput.class);
}
