/**
 * 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;
  }
  ///@}

  ///@{
  /**
   * <p>A custom name to override the job name derived from the job template.</p>
   */
  inline const Aws::String& GetNameOverride() const { return m_nameOverride; }
  inline bool NameOverrideHasBeenSet() const { return m_nameOverrideHasBeenSet; }
  template <typename NameOverrideT = Aws::String>
  void SetNameOverride(NameOverrideT&& value) {
    m_nameOverrideHasBeenSet = true;
    m_nameOverride = std::forward<NameOverrideT>(value);
  }
  template <typename NameOverrideT = Aws::String>
  CreateJobRequest& WithNameOverride(NameOverrideT&& value) {
    SetNameOverride(std::forward<NameOverrideT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>A custom description to override the job description derived from the job
   * template.</p>
   */
  inline const Aws::String& GetDescriptionOverride() const { return m_descriptionOverride; }
  inline bool DescriptionOverrideHasBeenSet() const { return m_descriptionOverrideHasBeenSet; }
  template <typename DescriptionOverrideT = Aws::String>
  void SetDescriptionOverride(DescriptionOverrideT&& value) {
    m_descriptionOverrideHasBeenSet = true;
    m_descriptionOverride = std::forward<DescriptionOverrideT>(value);
  }
  template <typename DescriptionOverrideT = Aws::String>
  CreateJobRequest& WithDescriptionOverride(DescriptionOverrideT&& value) {
    SetDescriptionOverride(std::forward<DescriptionOverrideT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The tags to add to your job. Each tag consists of a tag key and a tag value.
   * Tag keys and values are both required, but tag values can be empty strings.</p>
   */
  inline const Aws::Map<Aws::String, Aws::String>& GetTags() const { return m_tags; }
  inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; }
  template <typename TagsT = Aws::Map<Aws::String, Aws::String>>
  void SetTags(TagsT&& value) {
    m_tagsHasBeenSet = true;
    m_tags = std::forward<TagsT>(value);
  }
  template <typename TagsT = Aws::Map<Aws::String, Aws::String>>
  CreateJobRequest& WithTags(TagsT&& value) {
    SetTags(std::forward<TagsT>(value));
    return *this;
  }
  template <typename TagsKeyT = Aws::String, typename TagsValueT = Aws::String>
  CreateJobRequest& AddTags(TagsKeyT&& key, TagsValueT&& value) {
    m_tagsHasBeenSet = true;
    m_tags.emplace(std::forward<TagsKeyT>(key), std::forward<TagsValueT>(value));
    return *this;
  }
  ///@}
 private:
  Aws::String m_farmId;

  Aws::String m_queueId;

  Aws::String m_clientToken{Aws::Utils::UUID::PseudoRandomUUID()};

  Aws::String m_template;

  JobTemplateType m_templateType{JobTemplateType::NOT_SET};

  int m_priority{0};

  Aws::Map<Aws::String, JobParameter> m_parameters;

  Attachments m_attachments;

  Aws::String m_storageProfileId;

  CreateJobTargetTaskRunStatus m_targetTaskRunStatus{CreateJobTargetTaskRunStatus::NOT_SET};

  int m_maxFailedTasksCount{0};

  int m_maxRetriesPerTask{0};

  int m_maxWorkerCount{0};

  Aws::String m_sourceJobId;

  Aws::String m_nameOverride;

  Aws::String m_descriptionOverride;

  Aws::Map<Aws::String, Aws::String> m_tags;
  bool m_farmIdHasBeenSet = false;
  bool m_queueIdHasBeenSet = false;
  bool m_clientTokenHasBeenSet = true;
  bool m_templateHasBeenSet = false;
  bool m_templateTypeHasBeenSet = false;
  bool m_priorityHasBeenSet = false;
  bool m_parametersHasBeenSet = false;
  bool m_attachmentsHasBeenSet = false;
  bool m_storageProfileIdHasBeenSet = false;
  bool m_targetTaskRunStatusHasBeenSet = false;
  bool m_maxFailedTasksCountHasBeenSet = false;
  bool m_maxRetriesPerTaskHasBeenSet = false;
  bool m_maxWorkerCountHasBeenSet = false;
  bool m_sourceJobIdHasBeenSet = false;
  bool m_nameOverrideHasBeenSet = false;
  bool m_descriptionOverrideHasBeenSet = false;
  bool m_tagsHasBeenSet = false;
};

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