/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#pragma once
#include <aws/core/utils/UUID.h>
#include <aws/core/utils/memory/stl/AWSMap.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/deadline/DeadlineRequest.h>
#include <aws/deadline/Deadline_EXPORTS.h>
#include <aws/deadline/model/Attachments.h>
#include <aws/deadline/model/CreateJobTargetTaskRunStatus.h>
#include <aws/deadline/model/JobParameter.h>
#include <aws/deadline/model/JobTemplateType.h>

#include <utility>

namespace Aws {
namespace deadline {
namespace Model {

/**
 */
class CreateJobRequest : public DeadlineRequest {
 public:
  AWS_DEADLINE_API CreateJobRequest() = default;

  // Service request name is the Operation name which will send this request out,
  // each operation should has unique request name, so that we can get operation's name from this request.
  // Note: this is not true for response, multiple operations may have the same response name,
  // so we can not get operation's name from response.
  inline virtual const char* GetServiceRequestName() const override { return "CreateJob"; }

  AWS_DEADLINE_API Aws::String SerializePayload() const override;

  AWS_DEADLINE_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

  ///@{
  /**
   * <p>The farm ID of the farm to connect to the job.</p>
   */
  inline const Aws::String& GetFarmId() const { return m_farmId; }
  inline bool FarmIdHasBeenSet() const { return m_farmIdHasBeenSet; }
  template <typename FarmIdT = Aws::String>
  void SetFarmId(FarmIdT&& value) {
    m_farmIdHasBeenSet = true;
    m_farmId = std::forward<FarmIdT>(value);
  }
  template <typename FarmIdT = Aws::String>
  CreateJobRequest& WithFarmId(FarmIdT&& value) {
    SetFarmId(std::forward<FarmIdT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The ID of the queue that the job is submitted to.</p>
   */
  inline const Aws::String& GetQueueId() const { return m_queueId; }
  inline bool QueueIdHasBeenSet() const { return m_queueIdHasBeenSet; }
  template <typename QueueIdT = Aws::String>
  void SetQueueId(QueueIdT&& value) {
    m_queueIdHasBeenSet = true;
    m_queueId = std::forward<QueueIdT>(value);
  }
  template <typename QueueIdT = Aws::String>
  CreateJobRequest& WithQueueId(QueueIdT&& value) {
    SetQueueId(std::forward<QueueIdT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The unique token which the server uses to recognize retries of the same
   * request.</p>
   */
  inline const Aws::String& GetClientToken() const { return m_clientToken; }
  inline bool ClientTokenHasBeenSet() const { return m_clientTokenHasBeenSet; }
  template <typename ClientTokenT = Aws::String>
  void SetClientToken(ClientTokenT&& value) {
    m_clientTokenHasBeenSet = true;
    m_clientToken = std::forward<ClientTokenT>(value);
  }
  template <typename ClientTokenT = Aws::String>
  CreateJobRequest& WithClientToken(ClientTokenT&& value) {
    SetClientToken(std::forward<ClientTokenT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The job template to use for this job.</p>
   */
  inline const Aws::String& GetTemplate() const { return m_template; }
  inline bool TemplateHasBeenSet() const { return m_templateHasBeenSet; }
  template <typename TemplateT = Aws::String>
  void SetTemplate(TemplateT&& value) {
    m_templateHasBeenSet = true;
    m_template = std::forward<TemplateT>(value);
  }
  template <typename TemplateT = Aws::String>
  CreateJobRequest& WithTemplate(TemplateT&& value) {
    SetTemplate(std::forward<TemplateT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The file type for the job template.</p>
   */
  inline JobTemplateType GetTemplateType() const { return m_templateType; }
  inline bool TemplateTypeHasBeenSet() const { return m_templateTypeHasBeenSet; }
  inline void SetTemplateType(JobTemplateType value) {
    m_templateTypeHasBeenSet = true;
    m_templateType = value;
  }
  inline CreateJobRequest& WithTemplateType(JobTemplateType value) {
    SetTemplateType(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The priority of the job. The highest priority (first scheduled) is 100. When
   * two jobs have the same priority, the oldest job is scheduled first.</p>
   */
  inline int GetPriority() const { return m_priority; }
  inline bool PriorityHasBeenSet() const { return m_priorityHasBeenSet; }
  inline void SetPriority(int value) {
    m_priorityHasBeenSet = true;
    m_priority = value;
  }
  inline CreateJobRequest& WithPriority(int value) {
    SetPriority(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The parameters for the job.</p>
   */
  inline const Aws::Map<Aws::String, JobParameter>& GetParameters() const { return m_parameters; }
  inline bool ParametersHasBeenSet() const { return m_parametersHasBeenSet; }
  template <typename ParametersT = Aws::Map<Aws::String, JobParameter>>
  void SetParameters(ParametersT&& value) {
    m_parametersHasBeenSet = true;
    m_parameters = std::forward<ParametersT>(value);
  }
  template <typename ParametersT = Aws::Map<Aws::String, JobParameter>>
  CreateJobRequest& WithParameters(ParametersT&& value) {
    SetParameters(std::forward<ParametersT>(value));
    return *this;
  }
  template <typename ParametersKeyT = Aws::String, typename ParametersValueT = JobParameter>
  CreateJobRequest& AddParameters(ParametersKeyT&& key, ParametersValueT&& value) {
    m_parametersHasBeenSet = true;
    m_parameters.emplace(std::forward<ParametersKeyT>(key), std::forward<ParametersValueT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The attachments for the job. Attach files required for the job to run to a
   * render job.</p>
   */
  inline const Attachments& GetAttachments() const { return m_attachments; }
  inline bool AttachmentsHasBeenSet() const { return m_attachmentsHasBeenSet; }
  template <typename AttachmentsT = Attachments>
  void SetAttachments(AttachmentsT&& value) {
    m_attachmentsHasBeenSet = true;
    m_attachments = std::forward<AttachmentsT>(value);
  }
  template <typename AttachmentsT = Attachments>
  CreateJobRequest& WithAttachments(AttachmentsT&& value) {
    SetAttachments(std::forward<AttachmentsT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The storage profile ID for the storage profile to connect to the job.</p>
   */
  inline const Aws::String& GetStorageProfileId() const { return m_storageProfileId; }
  inline bool StorageProfileIdHasBeenSet() const { return m_storageProfileIdHasBeenSet; }
  template <typename StorageProfileIdT = Aws::String>
  void SetStorageProfileId(StorageProfileIdT&& value) {
    m_storageProfileIdHasBeenSet = true;
    m_storageProfileId = std::forward<StorageProfileIdT>(value);
  }
  template <typename StorageProfileIdT = Aws::String>
  CreateJobRequest& WithStorageProfileId(StorageProfileIdT&& value) {
    SetStorageProfileId(std::forward<StorageProfileIdT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The initial job status when it is created. Jobs that are created with a
   * <code>SUSPENDED</code> status will not run until manually requeued.</p>
   */
  inline CreateJobTargetTaskRunStatus GetTargetTaskRunStatus() const { return m_targetTaskRunStatus; }
  inline bool TargetTaskRunStatusHasBeenSet() const { return m_targetTaskRunStatusHasBeenSet; }
  inline void SetTargetTaskRunStatus(CreateJobTargetTaskRunStatus value) {
    m_targetTaskRunStatusHasBeenSet = true;
    m_targetTaskRunStatus = value;
  }
  inline CreateJobRequest& WithTargetTaskRunStatus(CreateJobTargetTaskRunStatus value) {
    SetTargetTaskRunStatus(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The number of task failures before the job stops running and is marked as
   * <code>FAILED</code>.</p>
   */
  inline int GetMaxFailedTasksCount() const { return m_maxFailedTasksCount; }
  inline bool MaxFailedTasksCountHasBeenSet() const { return m_maxFailedTasksCountHasBeenSet; }
  inline void SetMaxFailedTasksCount(int value) {
    m_maxFailedTasksCountHasBeenSet = true;
    m_maxFailedTasksCount = value;
  }
  inline CreateJobRequest& WithMaxFailedTasksCount(int value) {
    SetMaxFailedTasksCount(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The maximum number of retries for each task.</p>
   */
  inline int GetMaxRetriesPerTask() const { return m_maxRetriesPerTask; }
  inline bool MaxRetriesPerTaskHasBeenSet() const { return m_maxRetriesPerTaskHasBeenSet; }
  inline void SetMaxRetriesPerTask(int value) {
    m_maxRetriesPerTaskHasBeenSet = true;
    m_maxRetriesPerTask = value;
  }
  inline CreateJobRequest& WithMaxRetriesPerTask(int value) {
    SetMaxRetriesPerTask(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The maximum number of worker hosts that can concurrently process a job. When
   * the <code>maxWorkerCount</code> is reached, no more workers will be assigned to
   * process the job, even if the fleets assigned to the job's queue has available
   * workers.</p> <p>You can't set the <code>maxWorkerCount</code> to 0. If you set
   * it to -1, there is no maximum number of workers.</p> <p>If you don't specify the
   * <code>maxWorkerCount</code>, Deadline Cloud won't throttle the number of workers
   * used to process the job.</p>
   */
  inline int GetMaxWorkerCount() const { return m_maxWorkerCount; }
  inline bool MaxWorkerCountHasBeenSet() const { return m_maxWorkerCountHasBeenSet; }
  inline void SetMaxWorkerCount(int value) {
    m_maxWorkerCountHasBeenSet = true;
    m_maxWorkerCount = value;
  }
  inline CreateJobRequest& WithMaxWorkerCount(int value) {
    SetMaxWorkerCount(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The job ID for the source job.</p>
   */
  inline const Aws::String& GetSourceJobId() const { return m_sourceJobId; }
  inline bool SourceJobIdHasBeenSet() const { return m_sourceJobIdHasBeenSet; }
  template <typename SourceJobIdT = Aws::String>
  void SetSourceJobId(SourceJobIdT&& value) {
    m_sourceJobIdHasBeenSet = true;
    m_sourceJobId = std::forward<SourceJobIdT>(value);
  }
  template <typename SourceJobIdT = Aws::String>
  CreateJobRequest& WithSourceJobId(SourceJobIdT&& value) {
    SetSourceJobId(std::forward<SourceJobIdT>(value));
    return *this;
  }
  ///@}
 private:
  Aws::String m_farmId;
  bool m_farmIdHasBeenSet = false;

  Aws::String m_queueId;
  bool m_queueIdHasBeenSet = false;

  Aws::String m_clientToken{Aws::Utils::UUID::PseudoRandomUUID()};
  bool m_clientTokenHasBeenSet = true;

  Aws::String m_template;
  bool m_templateHasBeenSet = false;

  JobTemplateType m_templateType{JobTemplateType::NOT_SET};
  bool m_templateTypeHasBeenSet = false;

  int m_priority{0};
  bool m_priorityHasBeenSet = false;

  Aws::Map<Aws::String, JobParameter> m_parameters;
  bool m_parametersHasBeenSet = false;

  Attachments m_attachments;
  bool m_attachmentsHasBeenSet = false;

  Aws::String m_storageProfileId;
  bool m_storageProfileIdHasBeenSet = false;

  CreateJobTargetTaskRunStatus m_targetTaskRunStatus{CreateJobTargetTaskRunStatus::NOT_SET};
  bool m_targetTaskRunStatusHasBeenSet = false;

  int m_maxFailedTasksCount{0};
  bool m_maxFailedTasksCountHasBeenSet = false;

  int m_maxRetriesPerTask{0};
  bool m_maxRetriesPerTaskHasBeenSet = false;

  int m_maxWorkerCount{0};
  bool m_maxWorkerCountHasBeenSet = false;

  Aws::String m_sourceJobId;
  bool m_sourceJobIdHasBeenSet = false;
};

}  // namespace Model
}  // namespace deadline
}  // namespace Aws
