// 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 action details. */
@Fluent
public final class RecoveryPlanAction {
    /*
     * The action name.
     */
    @JsonProperty(value = "actionName", required = true)
    private String actionName;

    /*
     * The list of failover types.
     */
    @JsonProperty(value = "failoverTypes", required = true)
    private List<ReplicationProtectedItemOperation> failoverTypes;

    /*
     * The list of failover directions.
     */
    @JsonProperty(value = "failoverDirections", required = true)
    private List<PossibleOperationsDirections> failoverDirections;

    /*
     * The custom details.
     */
    @JsonProperty(value = "customDetails", required = true)
    private RecoveryPlanActionDetails customDetails;

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

    /**
     * Get the actionName property: The action name.
     *
     * @return the actionName value.
     */
    public String actionName() {
        return this.actionName;
    }

    /**
     * Set the actionName property: The action name.
     *
     * @param actionName the actionName value to set.
     * @return the RecoveryPlanAction object itself.
     */
    public RecoveryPlanAction withActionName(String actionName) {
        this.actionName = actionName;
        return this;
    }

    /**
     * Get the failoverTypes property: The list of failover types.
     *
     * @return the failoverTypes value.
     */
    public List<ReplicationProtectedItemOperation> failoverTypes() {
        return this.failoverTypes;
    }

    /**
     * Set the failoverTypes property: The list of failover types.
     *
     * @param failoverTypes the failoverTypes value to set.
     * @return the RecoveryPlanAction object itself.
     */
    public RecoveryPlanAction withFailoverTypes(List<ReplicationProtectedItemOperation> failoverTypes) {
        this.failoverTypes = failoverTypes;
        return this;
    }

    /**
     * Get the failoverDirections property: The list of failover directions.
     *
     * @return the failoverDirections value.
     */
    public List<PossibleOperationsDirections> failoverDirections() {
        return this.failoverDirections;
    }

    /**
     * Set the failoverDirections property: The list of failover directions.
     *
     * @param failoverDirections the failoverDirections value to set.
     * @return the RecoveryPlanAction object itself.
     */
    public RecoveryPlanAction withFailoverDirections(List<PossibleOperationsDirections> failoverDirections) {
        this.failoverDirections = failoverDirections;
        return this;
    }

    /**
     * Get the customDetails property: The custom details.
     *
     * @return the customDetails value.
     */
    public RecoveryPlanActionDetails customDetails() {
        return this.customDetails;
    }

    /**
     * Set the customDetails property: The custom details.
     *
     * @param customDetails the customDetails value to set.
     * @return the RecoveryPlanAction object itself.
     */
    public RecoveryPlanAction withCustomDetails(RecoveryPlanActionDetails customDetails) {
        this.customDetails = customDetails;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (actionName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property actionName in model RecoveryPlanAction"));
        }
        if (failoverTypes() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property failoverTypes in model RecoveryPlanAction"));
        }
        if (failoverDirections() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property failoverDirections in model RecoveryPlanAction"));
        }
        if (customDetails() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property customDetails in model RecoveryPlanAction"));
        } else {
            customDetails().validate();
        }
    }

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