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

package com.azure.resourcemanager.networkcloud.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * BareMetalMachineRunDataExtractsParameters represents the body of request containing list of curated data extraction
 * commands to run on the bare metal machine.
 */
@Fluent
public final class BareMetalMachineRunDataExtractsParameters {
    /*
     * The list of curated data extraction commands to be executed directly against the target machine.
     */
    @JsonProperty(value = "commands", required = true)
    private List<BareMetalMachineCommandSpecification> commands;

    /*
     * The maximum time the commands are allowed to run.
     * If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be
     * captured, and the exit code matching a timeout will be returned (252).
     */
    @JsonProperty(value = "limitTimeSeconds", required = true)
    private long limitTimeSeconds;

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

    /**
     * Get the commands property: The list of curated data extraction commands to be executed directly against the
     * target machine.
     *
     * @return the commands value.
     */
    public List<BareMetalMachineCommandSpecification> commands() {
        return this.commands;
    }

    /**
     * Set the commands property: The list of curated data extraction commands to be executed directly against the
     * target machine.
     *
     * @param commands the commands value to set.
     * @return the BareMetalMachineRunDataExtractsParameters object itself.
     */
    public BareMetalMachineRunDataExtractsParameters withCommands(List<BareMetalMachineCommandSpecification> commands) {
        this.commands = commands;
        return this;
    }

    /**
     * Get the limitTimeSeconds property: The maximum time the commands are allowed to run. If the execution time
     * exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit
     * code matching a timeout will be returned (252).
     *
     * @return the limitTimeSeconds value.
     */
    public long limitTimeSeconds() {
        return this.limitTimeSeconds;
    }

    /**
     * Set the limitTimeSeconds property: The maximum time the commands are allowed to run. If the execution time
     * exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit
     * code matching a timeout will be returned (252).
     *
     * @param limitTimeSeconds the limitTimeSeconds value to set.
     * @return the BareMetalMachineRunDataExtractsParameters object itself.
     */
    public BareMetalMachineRunDataExtractsParameters withLimitTimeSeconds(long limitTimeSeconds) {
        this.limitTimeSeconds = limitTimeSeconds;
        return this;
    }

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

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