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

package com.azure.resourcemanager.recoveryservicessiterecovery.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Migration item properties. */
@Fluent
public final class MigrationItemProperties {
    /*
     * The on-premise virtual machine name.
     */
    @JsonProperty(value = "machineName", access = JsonProperty.Access.WRITE_ONLY)
    private String machineName;

    /*
     * The ARM Id of policy governing this item.
     */
    @JsonProperty(value = "policyId", access = JsonProperty.Access.WRITE_ONLY)
    private String policyId;

    /*
     * The name of policy governing this item.
     */
    @JsonProperty(value = "policyFriendlyName", access = JsonProperty.Access.WRITE_ONLY)
    private String policyFriendlyName;

    /*
     * The recovery services provider ARM Id.
     */
    @JsonProperty(value = "recoveryServicesProviderId", access = JsonProperty.Access.WRITE_ONLY)
    private String recoveryServicesProviderId;

    /*
     * The replication status.
     */
    @JsonProperty(value = "replicationStatus", access = JsonProperty.Access.WRITE_ONLY)
    private String replicationStatus;

    /*
     * The migration status.
     */
    @JsonProperty(value = "migrationState", access = JsonProperty.Access.WRITE_ONLY)
    private MigrationState migrationState;

    /*
     * The migration state description.
     */
    @JsonProperty(value = "migrationStateDescription", access = JsonProperty.Access.WRITE_ONLY)
    private String migrationStateDescription;

    /*
     * The last test migration time.
     */
    @JsonProperty(value = "lastTestMigrationTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastTestMigrationTime;

    /*
     * The status of the last test migration.
     */
    @JsonProperty(value = "lastTestMigrationStatus", access = JsonProperty.Access.WRITE_ONLY)
    private String lastTestMigrationStatus;

    /*
     * The last migration time.
     */
    @JsonProperty(value = "lastMigrationTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastMigrationTime;

    /*
     * The status of the last migration.
     */
    @JsonProperty(value = "lastMigrationStatus", access = JsonProperty.Access.WRITE_ONLY)
    private String lastMigrationStatus;

    /*
     * The test migrate state.
     */
    @JsonProperty(value = "testMigrateState", access = JsonProperty.Access.WRITE_ONLY)
    private TestMigrationState testMigrateState;

    /*
     * The test migrate state description.
     */
    @JsonProperty(value = "testMigrateStateDescription", access = JsonProperty.Access.WRITE_ONLY)
    private String testMigrateStateDescription;

    /*
     * The consolidated health.
     */
    @JsonProperty(value = "health", access = JsonProperty.Access.WRITE_ONLY)
    private ProtectionHealth health;

    /*
     * The list of health errors.
     */
    @JsonProperty(value = "healthErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<HealthError> healthErrors;

    /*
     * The allowed operations on the migration item based on the current migration state of the item.
     */
    @JsonProperty(value = "allowedOperations", access = JsonProperty.Access.WRITE_ONLY)
    private List<MigrationItemOperation> allowedOperations;

    /*
     * The current job details.
     */
    @JsonProperty(value = "currentJob", access = JsonProperty.Access.WRITE_ONLY)
    private CurrentJobDetails currentJob;

    /*
     * The critical past job details.
     */
    @JsonProperty(value = "criticalJobHistory", access = JsonProperty.Access.WRITE_ONLY)
    private List<CriticalJobHistoryDetails> criticalJobHistory;

    /*
     * The correlation Id for events associated with this migration item.
     */
    @JsonProperty(value = "eventCorrelationId", access = JsonProperty.Access.WRITE_ONLY)
    private String eventCorrelationId;

    /*
     * The migration provider custom settings.
     */
    @JsonProperty(value = "providerSpecificDetails")
    private MigrationProviderSpecificSettings providerSpecificDetails;

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

    /**
     * Get the machineName property: The on-premise virtual machine name.
     *
     * @return the machineName value.
     */
    public String machineName() {
        return this.machineName;
    }

    /**
     * Get the policyId property: The ARM Id of policy governing this item.
     *
     * @return the policyId value.
     */
    public String policyId() {
        return this.policyId;
    }

    /**
     * Get the policyFriendlyName property: The name of policy governing this item.
     *
     * @return the policyFriendlyName value.
     */
    public String policyFriendlyName() {
        return this.policyFriendlyName;
    }

    /**
     * Get the recoveryServicesProviderId property: The recovery services provider ARM Id.
     *
     * @return the recoveryServicesProviderId value.
     */
    public String recoveryServicesProviderId() {
        return this.recoveryServicesProviderId;
    }

    /**
     * Get the replicationStatus property: The replication status.
     *
     * @return the replicationStatus value.
     */
    public String replicationStatus() {
        return this.replicationStatus;
    }

    /**
     * Get the migrationState property: The migration status.
     *
     * @return the migrationState value.
     */
    public MigrationState migrationState() {
        return this.migrationState;
    }

    /**
     * Get the migrationStateDescription property: The migration state description.
     *
     * @return the migrationStateDescription value.
     */
    public String migrationStateDescription() {
        return this.migrationStateDescription;
    }

    /**
     * Get the lastTestMigrationTime property: The last test migration time.
     *
     * @return the lastTestMigrationTime value.
     */
    public OffsetDateTime lastTestMigrationTime() {
        return this.lastTestMigrationTime;
    }

    /**
     * Get the lastTestMigrationStatus property: The status of the last test migration.
     *
     * @return the lastTestMigrationStatus value.
     */
    public String lastTestMigrationStatus() {
        return this.lastTestMigrationStatus;
    }

    /**
     * Get the lastMigrationTime property: The last migration time.
     *
     * @return the lastMigrationTime value.
     */
    public OffsetDateTime lastMigrationTime() {
        return this.lastMigrationTime;
    }

    /**
     * Get the lastMigrationStatus property: The status of the last migration.
     *
     * @return the lastMigrationStatus value.
     */
    public String lastMigrationStatus() {
        return this.lastMigrationStatus;
    }

    /**
     * Get the testMigrateState property: The test migrate state.
     *
     * @return the testMigrateState value.
     */
    public TestMigrationState testMigrateState() {
        return this.testMigrateState;
    }

    /**
     * Get the testMigrateStateDescription property: The test migrate state description.
     *
     * @return the testMigrateStateDescription value.
     */
    public String testMigrateStateDescription() {
        return this.testMigrateStateDescription;
    }

    /**
     * Get the health property: The consolidated health.
     *
     * @return the health value.
     */
    public ProtectionHealth health() {
        return this.health;
    }

    /**
     * Get the healthErrors property: The list of health errors.
     *
     * @return the healthErrors value.
     */
    public List<HealthError> healthErrors() {
        return this.healthErrors;
    }

    /**
     * Get the allowedOperations property: The allowed operations on the migration item based on the current migration
     * state of the item.
     *
     * @return the allowedOperations value.
     */
    public List<MigrationItemOperation> allowedOperations() {
        return this.allowedOperations;
    }

    /**
     * Get the currentJob property: The current job details.
     *
     * @return the currentJob value.
     */
    public CurrentJobDetails currentJob() {
        return this.currentJob;
    }

    /**
     * Get the criticalJobHistory property: The critical past job details.
     *
     * @return the criticalJobHistory value.
     */
    public List<CriticalJobHistoryDetails> criticalJobHistory() {
        return this.criticalJobHistory;
    }

    /**
     * Get the eventCorrelationId property: The correlation Id for events associated with this migration item.
     *
     * @return the eventCorrelationId value.
     */
    public String eventCorrelationId() {
        return this.eventCorrelationId;
    }

    /**
     * Get the providerSpecificDetails property: The migration provider custom settings.
     *
     * @return the providerSpecificDetails value.
     */
    public MigrationProviderSpecificSettings providerSpecificDetails() {
        return this.providerSpecificDetails;
    }

    /**
     * Set the providerSpecificDetails property: The migration provider custom settings.
     *
     * @param providerSpecificDetails the providerSpecificDetails value to set.
     * @return the MigrationItemProperties object itself.
     */
    public MigrationItemProperties withProviderSpecificDetails(
        MigrationProviderSpecificSettings providerSpecificDetails) {
        this.providerSpecificDetails = providerSpecificDetails;
        return this;
    }

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