// 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 creation properties. */
@Fluent
public final class CreateRecoveryPlanInputProperties {
    /*
     * The primary fabric Id.
     */
    @JsonProperty(value = "primaryFabricId", required = true)
    private String primaryFabricId;

    /*
     * The recovery fabric Id.
     */
    @JsonProperty(value = "recoveryFabricId", required = true)
    private String recoveryFabricId;

    /*
     * The failover deployment model.
     */
    @JsonProperty(value = "failoverDeploymentModel")
    private FailoverDeploymentModel failoverDeploymentModel;

    /*
     * The recovery plan groups.
     */
    @JsonProperty(value = "groups", required = true)
    private List<RecoveryPlanGroup> groups;

    /*
     * The provider specific input.
     */
    @JsonProperty(value = "providerSpecificInput")
    private List<RecoveryPlanProviderSpecificInput> providerSpecificInput;

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

    /**
     * Get the primaryFabricId property: The primary fabric Id.
     *
     * @return the primaryFabricId value.
     */
    public String primaryFabricId() {
        return this.primaryFabricId;
    }

    /**
     * Set the primaryFabricId property: The primary fabric Id.
     *
     * @param primaryFabricId the primaryFabricId value to set.
     * @return the CreateRecoveryPlanInputProperties object itself.
     */
    public CreateRecoveryPlanInputProperties withPrimaryFabricId(String primaryFabricId) {
        this.primaryFabricId = primaryFabricId;
        return this;
    }

    /**
     * Get the recoveryFabricId property: The recovery fabric Id.
     *
     * @return the recoveryFabricId value.
     */
    public String recoveryFabricId() {
        return this.recoveryFabricId;
    }

    /**
     * Set the recoveryFabricId property: The recovery fabric Id.
     *
     * @param recoveryFabricId the recoveryFabricId value to set.
     * @return the CreateRecoveryPlanInputProperties object itself.
     */
    public CreateRecoveryPlanInputProperties withRecoveryFabricId(String recoveryFabricId) {
        this.recoveryFabricId = recoveryFabricId;
        return this;
    }

    /**
     * Get the failoverDeploymentModel property: The failover deployment model.
     *
     * @return the failoverDeploymentModel value.
     */
    public FailoverDeploymentModel failoverDeploymentModel() {
        return this.failoverDeploymentModel;
    }

    /**
     * Set the failoverDeploymentModel property: The failover deployment model.
     *
     * @param failoverDeploymentModel the failoverDeploymentModel value to set.
     * @return the CreateRecoveryPlanInputProperties object itself.
     */
    public CreateRecoveryPlanInputProperties withFailoverDeploymentModel(
        FailoverDeploymentModel failoverDeploymentModel) {
        this.failoverDeploymentModel = failoverDeploymentModel;
        return this;
    }

    /**
     * Get the groups property: The recovery plan groups.
     *
     * @return the groups value.
     */
    public List<RecoveryPlanGroup> groups() {
        return this.groups;
    }

    /**
     * Set the groups property: The recovery plan groups.
     *
     * @param groups the groups value to set.
     * @return the CreateRecoveryPlanInputProperties object itself.
     */
    public CreateRecoveryPlanInputProperties withGroups(List<RecoveryPlanGroup> groups) {
        this.groups = groups;
        return this;
    }

    /**
     * Get the providerSpecificInput property: The provider specific input.
     *
     * @return the providerSpecificInput value.
     */
    public List<RecoveryPlanProviderSpecificInput> providerSpecificInput() {
        return this.providerSpecificInput;
    }

    /**
     * Set the providerSpecificInput property: The provider specific input.
     *
     * @param providerSpecificInput the providerSpecificInput value to set.
     * @return the CreateRecoveryPlanInputProperties object itself.
     */
    public CreateRecoveryPlanInputProperties withProviderSpecificInput(
        List<RecoveryPlanProviderSpecificInput> providerSpecificInput) {
        this.providerSpecificInput = providerSpecificInput;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (primaryFabricId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property primaryFabricId in model CreateRecoveryPlanInputProperties"));
        }
        if (recoveryFabricId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property recoveryFabricId in model CreateRecoveryPlanInputProperties"));
        }
        if (groups() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property groups in model CreateRecoveryPlanInputProperties"));
        } else {
            groups().forEach(e -> e.validate());
        }
        if (providerSpecificInput() != null) {
            providerSpecificInput().forEach(e -> e.validate());
        }
    }

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