import * as core from "@terrascript/core";

export interface TimeoutArgs extends core.SchemaArgs {
  attemptDurationSeconds?: number | core.NumberOut;
}

export class Timeout extends core.Schema<TimeoutArgs> {
  @core.attr(Number)
  public attemptDurationSeconds?: number | core.NumberOut;
}

export interface EvaluateOnExitArgs extends core.SchemaArgs {
  action: string | core.StringOut;

  onExitCode?: string | core.StringOut;

  onReason?: string | core.StringOut;

  onStatusReason?: string | core.StringOut;
}

export class EvaluateOnExit extends core.Schema<EvaluateOnExitArgs> {
  @core.attr(String)
  public action!: string | core.StringOut;

  @core.attr(String)
  public onExitCode?: string | core.StringOut;

  @core.attr(String)
  public onReason?: string | core.StringOut;

  @core.attr(String)
  public onStatusReason?: string | core.StringOut;
}

export interface RetryStrategyArgs extends core.SchemaArgs {
  attempts?: number | core.NumberOut;

  evaluateOnExit?: core.Array<EvaluateOnExit> | core.ArrayOut<EvaluateOnExit>;
}

export class RetryStrategy extends core.Schema<RetryStrategyArgs> {
  @core.attr(Number)
  public attempts?: number | core.NumberOut;

  @core.attr(EvaluateOnExit, { kind: "array" })
  public evaluateOnExit?:
    | core.Array<EvaluateOnExit>
    | core.ArrayOut<EvaluateOnExit>;
}

export interface JobDefinitionArgs extends core.ResourceArgs {
  containerProperties?: string | core.StringOut;

  name: string | core.StringOut;

  parameters?: core.Map<string, string> | core.MapOut<core.StringOut>;

  platformCapabilities?: core.Array<string> | core.ArrayOut<core.StringOut>;

  propagateTags?: boolean | core.BooleanOut;

  retryStrategy?: RetryStrategy;

  tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;

  timeout?: Timeout;

  type: string | core.StringOut;
}

export class JobDefinition extends core.Resource<JobDefinitionArgs> {
  @core.attr(String, { computed: true })
  public arn!: string | core.StringOut;

  @core.attr(String)
  public containerProperties?: string | core.StringOut;

  @core.attr(String, { computed: true })
  public id!: string | core.StringOut;

  @core.attr(String)
  public name!: string | core.StringOut;

  @core.attr(String, { kind: "map" })
  public parameters?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(String, { kind: "array" })
  public platformCapabilities?:
    | core.Array<string>
    | core.ArrayOut<core.StringOut>;

  @core.attr(Boolean)
  public propagateTags?: boolean | core.BooleanOut;

  @core.attr(RetryStrategy)
  public retryStrategy?: RetryStrategy;

  @core.attr(Number, { computed: true })
  public revision!: number | core.NumberOut;

  @core.attr(String, { kind: "map" })
  public tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(String, { computed: true, kind: "map" })
  public tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(Timeout)
  public timeout?: Timeout;

  @core.attr(String)
  public type!: string | core.StringOut;

  constructor(name: string, args?: JobDefinitionArgs) {
    super(name, "aws_batch_job_definition", args);
  }

  public override getNamespace(): string {
    return "aws_batch";
  }
}
