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

package com.azure.resourcemanager.batchai.models;

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

/** TensorFlow job settings. */
@Fluent
public final class TensorFlowSettings {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(TensorFlowSettings.class);

    /*
     * The python script to execute.
     */
    @JsonProperty(value = "pythonScriptFilePath", required = true)
    private String pythonScriptFilePath;

    /*
     * The path to the Python interpreter.
     */
    @JsonProperty(value = "pythonInterpreterPath")
    private String pythonInterpreterPath;

    /*
     * Command line arguments that need to be passed to the python script for
     * the master task.
     */
    @JsonProperty(value = "masterCommandLineArgs")
    private String masterCommandLineArgs;

    /*
     * Command line arguments that need to be passed to the python script for
     * the worker task. Optional for single process jobs.
     */
    @JsonProperty(value = "workerCommandLineArgs")
    private String workerCommandLineArgs;

    /*
     * Command line arguments that need to be passed to the python script for
     * the parameter server. Optional for single process jobs.
     */
    @JsonProperty(value = "parameterServerCommandLineArgs")
    private String parameterServerCommandLineArgs;

    /*
     * The number of worker tasks. If specified, the value must be less than or
     * equal to (nodeCount * numberOfGPUs per VM). If not specified, the
     * default value is equal to nodeCount. This property can be specified only
     * for distributed TensorFlow training.
     */
    @JsonProperty(value = "workerCount")
    private Integer workerCount;

    /*
     * The number of parameter server tasks. If specified, the value must be
     * less than or equal to nodeCount. If not specified, the default value is
     * equal to 1 for distributed TensorFlow training. This property can be
     * specified only for distributed TensorFlow training.
     */
    @JsonProperty(value = "parameterServerCount")
    private Integer parameterServerCount;

    /**
     * Get the pythonScriptFilePath property: The python script to execute.
     *
     * @return the pythonScriptFilePath value.
     */
    public String pythonScriptFilePath() {
        return this.pythonScriptFilePath;
    }

    /**
     * Set the pythonScriptFilePath property: The python script to execute.
     *
     * @param pythonScriptFilePath the pythonScriptFilePath value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withPythonScriptFilePath(String pythonScriptFilePath) {
        this.pythonScriptFilePath = pythonScriptFilePath;
        return this;
    }

    /**
     * Get the pythonInterpreterPath property: The path to the Python interpreter.
     *
     * @return the pythonInterpreterPath value.
     */
    public String pythonInterpreterPath() {
        return this.pythonInterpreterPath;
    }

    /**
     * Set the pythonInterpreterPath property: The path to the Python interpreter.
     *
     * @param pythonInterpreterPath the pythonInterpreterPath value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withPythonInterpreterPath(String pythonInterpreterPath) {
        this.pythonInterpreterPath = pythonInterpreterPath;
        return this;
    }

    /**
     * Get the masterCommandLineArgs property: Command line arguments that need to be passed to the python script for
     * the master task.
     *
     * @return the masterCommandLineArgs value.
     */
    public String masterCommandLineArgs() {
        return this.masterCommandLineArgs;
    }

    /**
     * Set the masterCommandLineArgs property: Command line arguments that need to be passed to the python script for
     * the master task.
     *
     * @param masterCommandLineArgs the masterCommandLineArgs value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withMasterCommandLineArgs(String masterCommandLineArgs) {
        this.masterCommandLineArgs = masterCommandLineArgs;
        return this;
    }

    /**
     * Get the workerCommandLineArgs property: Command line arguments that need to be passed to the python script for
     * the worker task. Optional for single process jobs.
     *
     * @return the workerCommandLineArgs value.
     */
    public String workerCommandLineArgs() {
        return this.workerCommandLineArgs;
    }

    /**
     * Set the workerCommandLineArgs property: Command line arguments that need to be passed to the python script for
     * the worker task. Optional for single process jobs.
     *
     * @param workerCommandLineArgs the workerCommandLineArgs value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withWorkerCommandLineArgs(String workerCommandLineArgs) {
        this.workerCommandLineArgs = workerCommandLineArgs;
        return this;
    }

    /**
     * Get the parameterServerCommandLineArgs property: Command line arguments that need to be passed to the python
     * script for the parameter server. Optional for single process jobs.
     *
     * @return the parameterServerCommandLineArgs value.
     */
    public String parameterServerCommandLineArgs() {
        return this.parameterServerCommandLineArgs;
    }

    /**
     * Set the parameterServerCommandLineArgs property: Command line arguments that need to be passed to the python
     * script for the parameter server. Optional for single process jobs.
     *
     * @param parameterServerCommandLineArgs the parameterServerCommandLineArgs value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withParameterServerCommandLineArgs(String parameterServerCommandLineArgs) {
        this.parameterServerCommandLineArgs = parameterServerCommandLineArgs;
        return this;
    }

    /**
     * Get the workerCount property: The number of worker tasks. If specified, the value must be less than or equal to
     * (nodeCount * numberOfGPUs per VM). If not specified, the default value is equal to nodeCount. This property can
     * be specified only for distributed TensorFlow training.
     *
     * @return the workerCount value.
     */
    public Integer workerCount() {
        return this.workerCount;
    }

    /**
     * Set the workerCount property: The number of worker tasks. If specified, the value must be less than or equal to
     * (nodeCount * numberOfGPUs per VM). If not specified, the default value is equal to nodeCount. This property can
     * be specified only for distributed TensorFlow training.
     *
     * @param workerCount the workerCount value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withWorkerCount(Integer workerCount) {
        this.workerCount = workerCount;
        return this;
    }

    /**
     * Get the parameterServerCount property: The number of parameter server tasks. If specified, the value must be less
     * than or equal to nodeCount. If not specified, the default value is equal to 1 for distributed TensorFlow
     * training. This property can be specified only for distributed TensorFlow training.
     *
     * @return the parameterServerCount value.
     */
    public Integer parameterServerCount() {
        return this.parameterServerCount;
    }

    /**
     * Set the parameterServerCount property: The number of parameter server tasks. If specified, the value must be less
     * than or equal to nodeCount. If not specified, the default value is equal to 1 for distributed TensorFlow
     * training. This property can be specified only for distributed TensorFlow training.
     *
     * @param parameterServerCount the parameterServerCount value to set.
     * @return the TensorFlowSettings object itself.
     */
    public TensorFlowSettings withParameterServerCount(Integer parameterServerCount) {
        this.parameterServerCount = parameterServerCount;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (pythonScriptFilePath() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property pythonScriptFilePath in model TensorFlowSettings"));
        }
    }
}
