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

export interface ConnectionPoolConfigArgs extends core.SchemaArgs {
  connectionBorrowTimeout?: number | core.NumberOut;

  initQuery?: string | core.StringOut;

  maxConnectionsPercent?: number | core.NumberOut;

  maxIdleConnectionsPercent?: number | core.NumberOut;

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

export class ConnectionPoolConfig extends core.Schema<ConnectionPoolConfigArgs> {
  @core.attr(Number)
  public connectionBorrowTimeout?: number | core.NumberOut;

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

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

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

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

export interface DbProxyDefaultTargetGroupArgs extends core.ResourceArgs {
  connectionPoolConfig?: ConnectionPoolConfig;

  dbProxyName: string | core.StringOut;
}

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

  @core.attr(ConnectionPoolConfig, { computed: true })
  public connectionPoolConfig?: ConnectionPoolConfig;

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

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

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

  constructor(name: string, args?: DbProxyDefaultTargetGroupArgs) {
    super(name, "aws_db_proxy_default_target_group", args);
  }

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