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

export interface ConfigurationsArgs extends core.SchemaArgs {
  classification?: string | core.StringOut;

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

export class Configurations extends core.Schema<ConfigurationsArgs> {
  @core.attr(String)
  public classification?: string | core.StringOut;

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

export interface EbsConfigArgs extends core.SchemaArgs {
  iops?: number | core.NumberOut;

  size: number | core.NumberOut;

  type: string | core.StringOut;

  volumesPerInstance?: number | core.NumberOut;
}

export class EbsConfig extends core.Schema<EbsConfigArgs> {
  @core.attr(Number)
  public iops?: number | core.NumberOut;

  @core.attr(Number)
  public size!: number | core.NumberOut;

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

  @core.attr(Number)
  public volumesPerInstance?: number | core.NumberOut;
}

export interface InstanceTypeConfigsArgs extends core.SchemaArgs {
  bidPrice?: string | core.StringOut;

  bidPriceAsPercentageOfOnDemandPrice?: number | core.NumberOut;

  configurations?: core.Array<Configurations> | core.ArrayOut<Configurations>;

  ebsConfig?: core.Array<EbsConfig> | core.ArrayOut<EbsConfig>;

  instanceType: string | core.StringOut;

  weightedCapacity?: number | core.NumberOut;
}

export class InstanceTypeConfigs extends core.Schema<InstanceTypeConfigsArgs> {
  @core.attr(String)
  public bidPrice?: string | core.StringOut;

  @core.attr(Number)
  public bidPriceAsPercentageOfOnDemandPrice?: number | core.NumberOut;

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

  @core.attr(EbsConfig, { computed: true, kind: "array" })
  public ebsConfig?: core.Array<EbsConfig> | core.ArrayOut<EbsConfig>;

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

  @core.attr(Number)
  public weightedCapacity?: number | core.NumberOut;
}

export interface OnDemandSpecificationArgs extends core.SchemaArgs {
  allocationStrategy: string | core.StringOut;
}

export class OnDemandSpecification extends core.Schema<OnDemandSpecificationArgs> {
  @core.attr(String)
  public allocationStrategy!: string | core.StringOut;
}

export interface SpotSpecificationArgs extends core.SchemaArgs {
  allocationStrategy: string | core.StringOut;

  blockDurationMinutes?: number | core.NumberOut;

  timeoutAction: string | core.StringOut;

  timeoutDurationMinutes: number | core.NumberOut;
}

export class SpotSpecification extends core.Schema<SpotSpecificationArgs> {
  @core.attr(String)
  public allocationStrategy!: string | core.StringOut;

  @core.attr(Number)
  public blockDurationMinutes?: number | core.NumberOut;

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

  @core.attr(Number)
  public timeoutDurationMinutes!: number | core.NumberOut;
}

export interface LaunchSpecificationsArgs extends core.SchemaArgs {
  onDemandSpecification?:
    | core.Array<OnDemandSpecification>
    | core.ArrayOut<OnDemandSpecification>;

  spotSpecification?:
    | core.Array<SpotSpecification>
    | core.ArrayOut<SpotSpecification>;
}

export class LaunchSpecifications extends core.Schema<LaunchSpecificationsArgs> {
  @core.attr(OnDemandSpecification, { kind: "array" })
  public onDemandSpecification?:
    | core.Array<OnDemandSpecification>
    | core.ArrayOut<OnDemandSpecification>;

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

export interface InstanceFleetArgs extends core.ResourceArgs {
  clusterId: string | core.StringOut;

  instanceTypeConfigs?:
    | core.Array<InstanceTypeConfigs>
    | core.ArrayOut<InstanceTypeConfigs>;

  launchSpecifications?: LaunchSpecifications;

  name?: string | core.StringOut;

  targetOnDemandCapacity?: number | core.NumberOut;

  targetSpotCapacity?: number | core.NumberOut;
}

export class InstanceFleet extends core.Resource<InstanceFleetArgs> {
  @core.attr(String)
  public clusterId!: string | core.StringOut;

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

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

  @core.attr(LaunchSpecifications)
  public launchSpecifications?: LaunchSpecifications;

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

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

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

  @core.attr(Number)
  public targetOnDemandCapacity?: number | core.NumberOut;

  @core.attr(Number)
  public targetSpotCapacity?: number | core.NumberOut;

  constructor(name: string, args?: InstanceFleetArgs) {
    super(name, "aws_emr_instance_fleet", args);
  }

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