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

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

  value?: number | core.NumberOut;
}

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

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

export interface TimeBasedCanaryArgs extends core.SchemaArgs {
  interval?: number | core.NumberOut;

  percentage?: number | core.NumberOut;
}

export class TimeBasedCanary extends core.Schema<TimeBasedCanaryArgs> {
  @core.attr(Number)
  public interval?: number | core.NumberOut;

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

export interface TimeBasedLinearArgs extends core.SchemaArgs {
  interval?: number | core.NumberOut;

  percentage?: number | core.NumberOut;
}

export class TimeBasedLinear extends core.Schema<TimeBasedLinearArgs> {
  @core.attr(Number)
  public interval?: number | core.NumberOut;

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

export interface TrafficRoutingConfigArgs extends core.SchemaArgs {
  timeBasedCanary?: TimeBasedCanary;

  timeBasedLinear?: TimeBasedLinear;

  type?: string | core.StringOut;
}

export class TrafficRoutingConfig extends core.Schema<TrafficRoutingConfigArgs> {
  @core.attr(TimeBasedCanary)
  public timeBasedCanary?: TimeBasedCanary;

  @core.attr(TimeBasedLinear)
  public timeBasedLinear?: TimeBasedLinear;

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

export interface DeploymentConfigArgs extends core.ResourceArgs {
  computePlatform?: string | core.StringOut;

  deploymentConfigName: string | core.StringOut;

  minimumHealthyHosts?: MinimumHealthyHosts;

  trafficRoutingConfig?: TrafficRoutingConfig;
}

export class DeploymentConfig extends core.Resource<DeploymentConfigArgs> {
  @core.attr(String)
  public computePlatform?: string | core.StringOut;

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

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

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

  @core.attr(MinimumHealthyHosts)
  public minimumHealthyHosts?: MinimumHealthyHosts;

  @core.attr(TrafficRoutingConfig)
  public trafficRoutingConfig?: TrafficRoutingConfig;

  constructor(name: string, args?: DeploymentConfigArgs) {
    super(name, "aws_codedeploy_deployment_config", args);
  }

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