// 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.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;
import java.util.List;

/** Database level result for Sql Server to Azure Sql DB migration. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType")
@JsonTypeName("DatabaseLevelOutput")
@Immutable
public final class MigrateSqlServerSqlDbTaskOutputDatabaseLevel extends MigrateSqlServerSqlDbTaskOutput {
    /*
     * Name of the item
     */
    @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY)
    private String databaseName;

    /*
     * Migration start time
     */
    @JsonProperty(value = "startedOn", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime startedOn;

    /*
     * Migration end time
     */
    @JsonProperty(value = "endedOn", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime endedOn;

    /*
     * Current state of migration
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private MigrationState state;

    /*
     * Migration stage that this database is in
     */
    @JsonProperty(value = "stage", access = JsonProperty.Access.WRITE_ONLY)
    private DatabaseMigrationStage stage;

    /*
     * Status message
     */
    @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String statusMessage;

    /*
     * Migration progress message
     */
    @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
    private String message;

    /*
     * Number of objects
     */
    @JsonProperty(value = "numberOfObjects", access = JsonProperty.Access.WRITE_ONLY)
    private Long numberOfObjects;

    /*
     * Number of successfully completed objects
     */
    @JsonProperty(value = "numberOfObjectsCompleted", access = JsonProperty.Access.WRITE_ONLY)
    private Long numberOfObjectsCompleted;

    /*
     * Number of database/object errors.
     */
    @JsonProperty(value = "errorCount", access = JsonProperty.Access.WRITE_ONLY)
    private Long errorCount;

    /*
     * Wildcard string prefix to use for querying all errors of the item
     */
    @JsonProperty(value = "errorPrefix", access = JsonProperty.Access.WRITE_ONLY)
    private String errorPrefix;

    /*
     * Wildcard string prefix to use for querying all sub-tem results of the item
     */
    @JsonProperty(value = "resultPrefix", access = JsonProperty.Access.WRITE_ONLY)
    private String resultPrefix;

    /*
     * Migration exceptions and warnings.
     */
    @JsonProperty(value = "exceptionsAndWarnings", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> exceptionsAndWarnings;

    /*
     * Summary of object results in the migration
     */
    @JsonProperty(value = "objectSummary", access = JsonProperty.Access.WRITE_ONLY)
    private String objectSummary;

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

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

    /**
     * Get the startedOn property: Migration start time.
     *
     * @return the startedOn value.
     */
    public OffsetDateTime startedOn() {
        return this.startedOn;
    }

    /**
     * Get the endedOn property: Migration end time.
     *
     * @return the endedOn value.
     */
    public OffsetDateTime endedOn() {
        return this.endedOn;
    }

    /**
     * Get the state property: Current state of migration.
     *
     * @return the state value.
     */
    public MigrationState state() {
        return this.state;
    }

    /**
     * Get the stage property: Migration stage that this database is in.
     *
     * @return the stage value.
     */
    public DatabaseMigrationStage stage() {
        return this.stage;
    }

    /**
     * Get the statusMessage property: Status message.
     *
     * @return the statusMessage value.
     */
    public String statusMessage() {
        return this.statusMessage;
    }

    /**
     * Get the message property: Migration progress message.
     *
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Get the numberOfObjects property: Number of objects.
     *
     * @return the numberOfObjects value.
     */
    public Long numberOfObjects() {
        return this.numberOfObjects;
    }

    /**
     * Get the numberOfObjectsCompleted property: Number of successfully completed objects.
     *
     * @return the numberOfObjectsCompleted value.
     */
    public Long numberOfObjectsCompleted() {
        return this.numberOfObjectsCompleted;
    }

    /**
     * Get the errorCount property: Number of database/object errors.
     *
     * @return the errorCount value.
     */
    public Long errorCount() {
        return this.errorCount;
    }

    /**
     * Get the errorPrefix property: Wildcard string prefix to use for querying all errors of the item.
     *
     * @return the errorPrefix value.
     */
    public String errorPrefix() {
        return this.errorPrefix;
    }

    /**
     * Get the resultPrefix property: Wildcard string prefix to use for querying all sub-tem results of the item.
     *
     * @return the resultPrefix value.
     */
    public String resultPrefix() {
        return this.resultPrefix;
    }

    /**
     * Get the exceptionsAndWarnings property: Migration exceptions and warnings.
     *
     * @return the exceptionsAndWarnings value.
     */
    public List<ReportableException> exceptionsAndWarnings() {
        return this.exceptionsAndWarnings;
    }

    /**
     * Get the objectSummary property: Summary of object results in the migration.
     *
     * @return the objectSummary value.
     */
    public String objectSummary() {
        return this.objectSummary;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (exceptionsAndWarnings() != null) {
            exceptionsAndWarnings().forEach(e -> e.validate());
        }
    }
}
