// 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.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Recovery plan unplanned failover input properties. */
@Fluent
public final class RecoveryPlanUnplannedFailoverInputProperties {
    /*
     * The failover direction.
     */
    @JsonProperty(value = "failoverDirection", required = true)
    private PossibleOperationsDirections failoverDirection;

    /*
     * A value indicating whether source site operations are required.
     */
    @JsonProperty(value = "sourceSiteOperations", required = true)
    private SourceSiteOperations sourceSiteOperations;

    /*
     * The provider specific properties.
     */
    @JsonProperty(value = "providerSpecificDetails")
    private List<RecoveryPlanProviderSpecificFailoverInput> providerSpecificDetails;

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

    /**
     * Get the failoverDirection property: The failover direction.
     *
     * @return the failoverDirection value.
     */
    public PossibleOperationsDirections failoverDirection() {
        return this.failoverDirection;
    }

    /**
     * Set the failoverDirection property: The failover direction.
     *
     * @param failoverDirection the failoverDirection value to set.
     * @return the RecoveryPlanUnplannedFailoverInputProperties object itself.
     */
    public RecoveryPlanUnplannedFailoverInputProperties withFailoverDirection(
        PossibleOperationsDirections failoverDirection) {
        this.failoverDirection = failoverDirection;
        return this;
    }

    /**
     * Get the sourceSiteOperations property: A value indicating whether source site operations are required.
     *
     * @return the sourceSiteOperations value.
     */
    public SourceSiteOperations sourceSiteOperations() {
        return this.sourceSiteOperations;
    }

    /**
     * Set the sourceSiteOperations property: A value indicating whether source site operations are required.
     *
     * @param sourceSiteOperations the sourceSiteOperations value to set.
     * @return the RecoveryPlanUnplannedFailoverInputProperties object itself.
     */
    public RecoveryPlanUnplannedFailoverInputProperties withSourceSiteOperations(
        SourceSiteOperations sourceSiteOperations) {
        this.sourceSiteOperations = sourceSiteOperations;
        return this;
    }

    /**
     * Get the providerSpecificDetails property: The provider specific properties.
     *
     * @return the providerSpecificDetails value.
     */
    public List<RecoveryPlanProviderSpecificFailoverInput> providerSpecificDetails() {
        return this.providerSpecificDetails;
    }

    /**
     * Set the providerSpecificDetails property: The provider specific properties.
     *
     * @param providerSpecificDetails the providerSpecificDetails value to set.
     * @return the RecoveryPlanUnplannedFailoverInputProperties object itself.
     */
    public RecoveryPlanUnplannedFailoverInputProperties withProviderSpecificDetails(
        List<RecoveryPlanProviderSpecificFailoverInput> providerSpecificDetails) {
        this.providerSpecificDetails = providerSpecificDetails;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (failoverDirection() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property failoverDirection in model"
                            + " RecoveryPlanUnplannedFailoverInputProperties"));
        }
        if (sourceSiteOperations() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sourceSiteOperations in model"
                            + " RecoveryPlanUnplannedFailoverInputProperties"));
        }
        if (providerSpecificDetails() != null) {
            providerSpecificDetails().forEach(e -> e.validate());
        }
    }

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