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

/** Database specific information for SQL to Azure SQL DB Managed Instance migration task inputs. */
@Fluent
public final class MigrateSqlServerSqlMIDatabaseInput {
    /*
     * Name of the database
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Name of the database at destination
     */
    @JsonProperty(value = "restoreDatabaseName", required = true)
    private String restoreDatabaseName;

    /*
     * Backup file share information for backing up this database.
     */
    @JsonProperty(value = "backupFileShare")
    private FileShare backupFileShare;

    /*
     * The list of backup files to be used in case of existing backups.
     */
    @JsonProperty(value = "backupFilePaths")
    private List<String> backupFilePaths;

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

    /**
     * Get the name property: Name of the database.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the database.
     *
     * @param name the name value to set.
     * @return the MigrateSqlServerSqlMIDatabaseInput object itself.
     */
    public MigrateSqlServerSqlMIDatabaseInput withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the restoreDatabaseName property: Name of the database at destination.
     *
     * @return the restoreDatabaseName value.
     */
    public String restoreDatabaseName() {
        return this.restoreDatabaseName;
    }

    /**
     * Set the restoreDatabaseName property: Name of the database at destination.
     *
     * @param restoreDatabaseName the restoreDatabaseName value to set.
     * @return the MigrateSqlServerSqlMIDatabaseInput object itself.
     */
    public MigrateSqlServerSqlMIDatabaseInput withRestoreDatabaseName(String restoreDatabaseName) {
        this.restoreDatabaseName = restoreDatabaseName;
        return this;
    }

    /**
     * Get the backupFileShare property: Backup file share information for backing up this database.
     *
     * @return the backupFileShare value.
     */
    public FileShare backupFileShare() {
        return this.backupFileShare;
    }

    /**
     * Set the backupFileShare property: Backup file share information for backing up this database.
     *
     * @param backupFileShare the backupFileShare value to set.
     * @return the MigrateSqlServerSqlMIDatabaseInput object itself.
     */
    public MigrateSqlServerSqlMIDatabaseInput withBackupFileShare(FileShare backupFileShare) {
        this.backupFileShare = backupFileShare;
        return this;
    }

    /**
     * Get the backupFilePaths property: The list of backup files to be used in case of existing backups.
     *
     * @return the backupFilePaths value.
     */
    public List<String> backupFilePaths() {
        return this.backupFilePaths;
    }

    /**
     * Set the backupFilePaths property: The list of backup files to be used in case of existing backups.
     *
     * @param backupFilePaths the backupFilePaths value to set.
     * @return the MigrateSqlServerSqlMIDatabaseInput object itself.
     */
    public MigrateSqlServerSqlMIDatabaseInput withBackupFilePaths(List<String> backupFilePaths) {
        this.backupFilePaths = backupFilePaths;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (name() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property name in model MigrateSqlServerSqlMIDatabaseInput"));
        }
        if (restoreDatabaseName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property restoreDatabaseName in model MigrateSqlServerSqlMIDatabaseInput"));
        }
        if (backupFileShare() != null) {
            backupFileShare().validate();
        }
    }

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