// 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 com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Recovery plan Automation runbook action details. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "instanceType")
@JsonTypeName("AutomationRunbookActionDetails")
@Fluent
public final class RecoveryPlanAutomationRunbookActionDetails extends RecoveryPlanActionDetails {
    /*
     * The runbook ARM Id.
     */
    @JsonProperty(value = "runbookId")
    private String runbookId;

    /*
     * The runbook timeout.
     */
    @JsonProperty(value = "timeout")
    private String timeout;

    /*
     * The fabric location.
     */
    @JsonProperty(value = "fabricLocation", required = true)
    private RecoveryPlanActionLocation fabricLocation;

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

    /**
     * Get the runbookId property: The runbook ARM Id.
     *
     * @return the runbookId value.
     */
    public String runbookId() {
        return this.runbookId;
    }

    /**
     * Set the runbookId property: The runbook ARM Id.
     *
     * @param runbookId the runbookId value to set.
     * @return the RecoveryPlanAutomationRunbookActionDetails object itself.
     */
    public RecoveryPlanAutomationRunbookActionDetails withRunbookId(String runbookId) {
        this.runbookId = runbookId;
        return this;
    }

    /**
     * Get the timeout property: The runbook timeout.
     *
     * @return the timeout value.
     */
    public String timeout() {
        return this.timeout;
    }

    /**
     * Set the timeout property: The runbook timeout.
     *
     * @param timeout the timeout value to set.
     * @return the RecoveryPlanAutomationRunbookActionDetails object itself.
     */
    public RecoveryPlanAutomationRunbookActionDetails withTimeout(String timeout) {
        this.timeout = timeout;
        return this;
    }

    /**
     * Get the fabricLocation property: The fabric location.
     *
     * @return the fabricLocation value.
     */
    public RecoveryPlanActionLocation fabricLocation() {
        return this.fabricLocation;
    }

    /**
     * Set the fabricLocation property: The fabric location.
     *
     * @param fabricLocation the fabricLocation value to set.
     * @return the RecoveryPlanAutomationRunbookActionDetails object itself.
     */
    public RecoveryPlanAutomationRunbookActionDetails withFabricLocation(RecoveryPlanActionLocation fabricLocation) {
        this.fabricLocation = fabricLocation;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (fabricLocation() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property fabricLocation in model"
                            + " RecoveryPlanAutomationRunbookActionDetails"));
        }
    }

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