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

export interface InstanceDefinitionArgs extends core.SchemaArgs {
  instanceType: string | core.StringOut;

  weightedCapacity?: string | core.StringOut;
}

export class InstanceDefinition extends core.Schema<InstanceDefinitionArgs> {
  @core.attr(String)
  public instanceType!: string | core.StringOut;

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

export interface TargetTrackingConfigurationArgs extends core.SchemaArgs {
  targetValue: number | core.NumberOut;
}

export class TargetTrackingConfiguration extends core.Schema<TargetTrackingConfigurationArgs> {
  @core.attr(Number)
  public targetValue!: number | core.NumberOut;
}

export interface AutoScalingPolicyArgs extends core.SchemaArgs {
  estimatedInstanceWarmup?: number | core.NumberOut;

  targetTrackingConfiguration: TargetTrackingConfiguration;
}

export class AutoScalingPolicy extends core.Schema<AutoScalingPolicyArgs> {
  @core.attr(Number, { computed: true })
  public estimatedInstanceWarmup?: number | core.NumberOut;

  @core.attr(TargetTrackingConfiguration)
  public targetTrackingConfiguration!: TargetTrackingConfiguration;
}

export interface LaunchTemplateArgs extends core.SchemaArgs {
  id?: string | core.StringOut;

  name?: string | core.StringOut;

  version?: string | core.StringOut;
}

export class LaunchTemplate extends core.Schema<LaunchTemplateArgs> {
  @core.attr(String, { computed: true })
  public id?: string | core.StringOut;

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

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

export interface GameServerGroupArgs extends core.ResourceArgs {
  autoScalingPolicy?: AutoScalingPolicy;

  /**
   * (Optional) Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances
   * .
   */
  balancingStrategy?: string | core.StringOut;

  /**
   * (Required) Name of the game server group.
   */
  gameServerGroupName: string | core.StringOut;

  /**
   * (Optional) Indicates whether instances in the game server group are protected from early termination
   * .
   */
  gameServerProtectionPolicy?: string | core.StringOut;

  instanceDefinition:
    | core.Array<InstanceDefinition>
    | core.ArrayOut<InstanceDefinition>;

  launchTemplate: LaunchTemplate;

  /**
   * (Required) The maximum number of instances allowed in the EC2 Auto Scaling group.
   */
  maxSize: number | core.NumberOut;

  /**
   * (Required) The minimum number of instances allowed in the EC2 Auto Scaling group.
   */
  minSize: number | core.NumberOut;

  /**
   * (Required) ARN for an IAM role that allows Amazon GameLift to access your EC2 Auto Scaling groups.
   */
  roleArn: string | core.StringOut;

  /**
   * (Optional) Key-value map of resource tags
   */
  tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

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

  /**
   * (Optional) A list of VPC subnets to use with instances in the game server group.
   */
  vpcSubnets?: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export class GameServerGroup extends core.Resource<GameServerGroupArgs> {
  /**
   * The ARN of the GameLift Game Server Group.
   */
  @core.attr(String, { computed: true })
  public arn!: string | core.StringOut;

  /**
   * The ARN of the created EC2 Auto Scaling group.
   */
  @core.attr(String, { computed: true })
  public autoScalingGroupArn!: string | core.StringOut;

  @core.attr(AutoScalingPolicy)
  public autoScalingPolicy?: AutoScalingPolicy;

  /**
   * (Optional) Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances
   * .
   */
  @core.attr(String, { computed: true })
  public balancingStrategy?: string | core.StringOut;

  /**
   * (Required) Name of the game server group.
   */
  @core.attr(String)
  public gameServerGroupName!: string | core.StringOut;

  /**
   * (Optional) Indicates whether instances in the game server group are protected from early termination
   * .
   */
  @core.attr(String, { computed: true })
  public gameServerProtectionPolicy?: string | core.StringOut;

  /**
   * (Optional) A unique identifier for an existing EC2 launch template.
   */
  @core.attr(String, { computed: true })
  public id!: string | core.StringOut;

  @core.attr(InstanceDefinition, { kind: "array" })
  public instanceDefinition!:
    | core.Array<InstanceDefinition>
    | core.ArrayOut<InstanceDefinition>;

  @core.attr(LaunchTemplate)
  public launchTemplate!: LaunchTemplate;

  /**
   * (Required) The maximum number of instances allowed in the EC2 Auto Scaling group.
   */
  @core.attr(Number)
  public maxSize!: number | core.NumberOut;

  /**
   * (Required) The minimum number of instances allowed in the EC2 Auto Scaling group.
   */
  @core.attr(Number)
  public minSize!: number | core.NumberOut;

  /**
   * (Required) ARN for an IAM role that allows Amazon GameLift to access your EC2 Auto Scaling groups.
   */
  @core.attr(String)
  public roleArn!: string | core.StringOut;

  /**
   * (Optional) Key-value map of resource tags
   */
  @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>;

  /**
   * (Optional) A list of VPC subnets to use with instances in the game server group.
   */
  @core.attr(String, { kind: "array" })
  public vpcSubnets?: core.Array<string> | core.ArrayOut<core.StringOut>;

  constructor(name: string, args?: GameServerGroupArgs) {
    super(name, "aws_gamelift_game_server_group", args);
  }

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