// 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 collects user tables for the given list of databases. */
@Fluent
public final class GetUserTablesSqlTaskInput {
    /*
     * Connection information for SQL Server
     */
    @JsonProperty(value = "connectionInfo", required = true)
    private SqlConnectionInfo connectionInfo;

    /*
     * List of database names to collect tables for
     */
    @JsonProperty(value = "selectedDatabases", required = true)
    private List<String> selectedDatabases;

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

    /**
     * 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 GetUserTablesSqlTaskInput object itself.
     */
    public GetUserTablesSqlTaskInput withConnectionInfo(SqlConnectionInfo connectionInfo) {
        this.connectionInfo = connectionInfo;
        return this;
    }

    /**
     * Get the selectedDatabases property: List of database names to collect tables for.
     *
     * @return the selectedDatabases value.
     */
    public List<String> selectedDatabases() {
        return this.selectedDatabases;
    }

    /**
     * Set the selectedDatabases property: List of database names to collect tables for.
     *
     * @param selectedDatabases the selectedDatabases value to set.
     * @return the GetUserTablesSqlTaskInput object itself.
     */
    public GetUserTablesSqlTaskInput withSelectedDatabases(List<String> selectedDatabases) {
        this.selectedDatabases = selectedDatabases;
        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 GetUserTablesSqlTaskInput"));
        } else {
            connectionInfo().validate();
        }
        if (selectedDatabases() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property selectedDatabases in model GetUserTablesSqlTaskInput"));
        }
    }

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