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

export interface CapacityProviderStrategyArgs extends core.SchemaArgs {
  base?: number | core.NumberOut;

  capacityProvider: string | core.StringOut;

  weight?: number | core.NumberOut;
}

export class CapacityProviderStrategy extends core.Schema<CapacityProviderStrategyArgs> {
  @core.attr(Number)
  public base?: number | core.NumberOut;

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

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

export interface LoadBalancerArgs extends core.SchemaArgs {
  containerName: string | core.StringOut;

  containerPort: number | core.NumberOut;

  elbName?: string | core.StringOut;

  targetGroupArn?: string | core.StringOut;
}

export class LoadBalancer extends core.Schema<LoadBalancerArgs> {
  @core.attr(String)
  public containerName!: string | core.StringOut;

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

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

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

export interface ServiceRegistriesArgs extends core.SchemaArgs {
  containerName?: string | core.StringOut;

  containerPort?: number | core.NumberOut;

  port?: number | core.NumberOut;

  registryArn: string | core.StringOut;
}

export class ServiceRegistries extends core.Schema<ServiceRegistriesArgs> {
  @core.attr(String)
  public containerName?: string | core.StringOut;

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

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

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

export interface DeploymentCircuitBreakerArgs extends core.SchemaArgs {
  enable: boolean | core.BooleanOut;

  rollback: boolean | core.BooleanOut;
}

export class DeploymentCircuitBreaker extends core.Schema<DeploymentCircuitBreakerArgs> {
  @core.attr(Boolean)
  public enable!: boolean | core.BooleanOut;

  @core.attr(Boolean)
  public rollback!: boolean | core.BooleanOut;
}

export interface PlacementConstraintsArgs extends core.SchemaArgs {
  expression?: string | core.StringOut;

  type: string | core.StringOut;
}

export class PlacementConstraints extends core.Schema<PlacementConstraintsArgs> {
  @core.attr(String)
  public expression?: string | core.StringOut;

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

export interface DeploymentControllerArgs extends core.SchemaArgs {
  type?: string | core.StringOut;
}

export class DeploymentController extends core.Schema<DeploymentControllerArgs> {
  @core.attr(String)
  public type?: string | core.StringOut;
}

export interface NetworkConfigurationArgs extends core.SchemaArgs {
  assignPublicIp?: boolean | core.BooleanOut;

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

  subnets: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export class NetworkConfiguration extends core.Schema<NetworkConfigurationArgs> {
  @core.attr(Boolean)
  public assignPublicIp?: boolean | core.BooleanOut;

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

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

export interface OrderedPlacementStrategyArgs extends core.SchemaArgs {
  field?: string | core.StringOut;

  type: string | core.StringOut;
}

export class OrderedPlacementStrategy extends core.Schema<OrderedPlacementStrategyArgs> {
  @core.attr(String)
  public field?: string | core.StringOut;

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

export interface ServiceArgs extends core.ResourceArgs {
  capacityProviderStrategy?:
    | core.Array<CapacityProviderStrategy>
    | core.ArrayOut<CapacityProviderStrategy>;

  cluster?: string | core.StringOut;

  deploymentCircuitBreaker?: DeploymentCircuitBreaker;

  deploymentController?: DeploymentController;

  deploymentMaximumPercent?: number | core.NumberOut;

  deploymentMinimumHealthyPercent?: number | core.NumberOut;

  desiredCount?: number | core.NumberOut;

  enableEcsManagedTags?: boolean | core.BooleanOut;

  enableExecuteCommand?: boolean | core.BooleanOut;

  forceNewDeployment?: boolean | core.BooleanOut;

  healthCheckGracePeriodSeconds?: number | core.NumberOut;

  iamRole?: string | core.StringOut;

  launchType?: string | core.StringOut;

  loadBalancer?: core.Array<LoadBalancer> | core.ArrayOut<LoadBalancer>;

  name: string | core.StringOut;

  networkConfiguration?: NetworkConfiguration;

  orderedPlacementStrategy?:
    | core.Array<OrderedPlacementStrategy>
    | core.ArrayOut<OrderedPlacementStrategy>;

  placementConstraints?:
    | core.Array<PlacementConstraints>
    | core.ArrayOut<PlacementConstraints>;

  platformVersion?: string | core.StringOut;

  propagateTags?: string | core.StringOut;

  schedulingStrategy?: string | core.StringOut;

  serviceRegistries?: ServiceRegistries;

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

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

  taskDefinition?: string | core.StringOut;

  waitForSteadyState?: boolean | core.BooleanOut;
}

export class Service extends core.Resource<ServiceArgs> {
  @core.attr(CapacityProviderStrategy, { kind: "array" })
  public capacityProviderStrategy?:
    | core.Array<CapacityProviderStrategy>
    | core.ArrayOut<CapacityProviderStrategy>;

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

  @core.attr(DeploymentCircuitBreaker)
  public deploymentCircuitBreaker?: DeploymentCircuitBreaker;

  @core.attr(DeploymentController)
  public deploymentController?: DeploymentController;

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

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

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

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

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

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

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

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

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

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

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

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

  @core.attr(NetworkConfiguration)
  public networkConfiguration?: NetworkConfiguration;

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

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

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

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

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

  @core.attr(ServiceRegistries)
  public serviceRegistries?: ServiceRegistries;

  @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(String)
  public taskDefinition?: string | core.StringOut;

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

  constructor(name: string, args?: ServiceArgs) {
    super(name, "aws_ecs_service", args);
  }

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