// 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.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Output for task that validates migration input for SQL to Azure SQL Managed Instance migrations. */
@Fluent
public final class ValidateMigrationInputSqlServerSqlMITaskOutput {
    /*
     * Result identifier
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Name of database
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * Errors associated with the RestoreDatabaseName
     */
    @JsonProperty(value = "restoreDatabaseNameErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> restoreDatabaseNameErrors;

    /*
     * Errors associated with the BackupFolder path
     */
    @JsonProperty(value = "backupFolderErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> backupFolderErrors;

    /*
     * Errors associated with backup share user name and password credentials
     */
    @JsonProperty(value = "backupShareCredentialsErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> backupShareCredentialsErrors;

    /*
     * Errors associated with the storage account provided.
     */
    @JsonProperty(value = "backupStorageAccountErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> backupStorageAccountErrors;

    /*
     * Errors associated with existing backup files.
     */
    @JsonProperty(value = "existingBackupErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> existingBackupErrors;

    /*
     * Information about backup files when existing backup mode is used.
     */
    @JsonProperty(value = "databaseBackupInfo")
    private DatabaseBackupInfo databaseBackupInfo;

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

    /**
     * Get the id property: Result identifier.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

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

    /**
     * Get the restoreDatabaseNameErrors property: Errors associated with the RestoreDatabaseName.
     *
     * @return the restoreDatabaseNameErrors value.
     */
    public List<ReportableException> restoreDatabaseNameErrors() {
        return this.restoreDatabaseNameErrors;
    }

    /**
     * Get the backupFolderErrors property: Errors associated with the BackupFolder path.
     *
     * @return the backupFolderErrors value.
     */
    public List<ReportableException> backupFolderErrors() {
        return this.backupFolderErrors;
    }

    /**
     * Get the backupShareCredentialsErrors property: Errors associated with backup share user name and password
     * credentials.
     *
     * @return the backupShareCredentialsErrors value.
     */
    public List<ReportableException> backupShareCredentialsErrors() {
        return this.backupShareCredentialsErrors;
    }

    /**
     * Get the backupStorageAccountErrors property: Errors associated with the storage account provided.
     *
     * @return the backupStorageAccountErrors value.
     */
    public List<ReportableException> backupStorageAccountErrors() {
        return this.backupStorageAccountErrors;
    }

    /**
     * Get the existingBackupErrors property: Errors associated with existing backup files.
     *
     * @return the existingBackupErrors value.
     */
    public List<ReportableException> existingBackupErrors() {
        return this.existingBackupErrors;
    }

    /**
     * Get the databaseBackupInfo property: Information about backup files when existing backup mode is used.
     *
     * @return the databaseBackupInfo value.
     */
    public DatabaseBackupInfo databaseBackupInfo() {
        return this.databaseBackupInfo;
    }

    /**
     * Set the databaseBackupInfo property: Information about backup files when existing backup mode is used.
     *
     * @param databaseBackupInfo the databaseBackupInfo value to set.
     * @return the ValidateMigrationInputSqlServerSqlMITaskOutput object itself.
     */
    public ValidateMigrationInputSqlServerSqlMITaskOutput withDatabaseBackupInfo(
        DatabaseBackupInfo databaseBackupInfo) {
        this.databaseBackupInfo = databaseBackupInfo;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (restoreDatabaseNameErrors() != null) {
            restoreDatabaseNameErrors().forEach(e -> e.validate());
        }
        if (backupFolderErrors() != null) {
            backupFolderErrors().forEach(e -> e.validate());
        }
        if (backupShareCredentialsErrors() != null) {
            backupShareCredentialsErrors().forEach(e -> e.validate());
        }
        if (backupStorageAccountErrors() != null) {
            backupStorageAccountErrors().forEach(e -> e.validate());
        }
        if (existingBackupErrors() != null) {
            existingBackupErrors().forEach(e -> e.validate());
        }
        if (databaseBackupInfo() != null) {
            databaseBackupInfo().validate();
        }
    }
}
