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

export interface HealthCheckArgs extends core.SchemaArgs {
  healthyThreshold?: number | core.NumberOut;

  intervalSeconds?: number | core.NumberOut;

  path?: string | core.StringOut;

  successCodes?: string | core.StringOut;

  timeoutSeconds?: number | core.NumberOut;

  unhealthyThreshold?: number | core.NumberOut;
}

export class HealthCheck extends core.Schema<HealthCheckArgs> {
  @core.attr(Number)
  public healthyThreshold?: number | core.NumberOut;

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

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

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

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

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

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

  containerPort: number | core.NumberOut;

  healthCheck: HealthCheck;
}

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

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

  @core.attr(HealthCheck)
  public healthCheck!: HealthCheck;
}

export interface ContainerArgs extends core.SchemaArgs {
  command?: core.Array<string> | core.ArrayOut<core.StringOut>;

  containerName: string | core.StringOut;

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

  image: string | core.StringOut;

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

export class Container extends core.Schema<ContainerArgs> {
  @core.attr(String, { kind: "array" })
  public command?: core.Array<string> | core.ArrayOut<core.StringOut>;

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

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

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

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

export interface ContainerServiceDeploymentVersionArgs
  extends core.ResourceArgs {
  container: core.Array<Container> | core.ArrayOut<Container>;

  publicEndpoint?: PublicEndpoint;

  serviceName: string | core.StringOut;
}

export class ContainerServiceDeploymentVersion extends core.Resource<ContainerServiceDeploymentVersionArgs> {
  @core.attr(Container, { kind: "array" })
  public container!: core.Array<Container> | core.ArrayOut<Container>;

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

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

  @core.attr(PublicEndpoint)
  public publicEndpoint?: PublicEndpoint;

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

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

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

  constructor(name: string, args?: ContainerServiceDeploymentVersionArgs) {
    super(name, "aws_lightsail_container_service_deployment_version", args);
  }

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