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

export interface EndpointConfigurationArgs extends core.SchemaArgs {
  clientIpPreservationEnabled?: boolean | core.BooleanOut;

  endpointId?: string | core.StringOut;

  weight?: number | core.NumberOut;
}

export class EndpointConfiguration extends core.Schema<EndpointConfigurationArgs> {
  @core.attr(Boolean, { computed: true })
  public clientIpPreservationEnabled?: boolean | core.BooleanOut;

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

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

export interface PortOverrideArgs extends core.SchemaArgs {
  endpointPort: number | core.NumberOut;

  listenerPort: number | core.NumberOut;
}

export class PortOverride extends core.Schema<PortOverrideArgs> {
  @core.attr(Number)
  public endpointPort!: number | core.NumberOut;

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

export interface EndpointGroupArgs extends core.ResourceArgs {
  endpointConfiguration?:
    | core.Array<EndpointConfiguration>
    | core.ArrayOut<EndpointConfiguration>;

  endpointGroupRegion?: string | core.StringOut;

  healthCheckIntervalSeconds?: number | core.NumberOut;

  healthCheckPath?: string | core.StringOut;

  healthCheckPort?: number | core.NumberOut;

  healthCheckProtocol?: string | core.StringOut;

  listenerArn: string | core.StringOut;

  portOverride?: core.Array<PortOverride> | core.ArrayOut<PortOverride>;

  thresholdCount?: number | core.NumberOut;

  trafficDialPercentage?: number | core.NumberOut;
}

export class EndpointGroup extends core.Resource<EndpointGroupArgs> {
  @core.attr(String, { computed: true })
  public arn!: string | core.StringOut;

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

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

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

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

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

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

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

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

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

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

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

  constructor(name: string, args?: EndpointGroupArgs) {
    super(name, "aws_globalaccelerator_endpoint_group", args);
  }

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