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

export interface RedirectArgs extends core.SchemaArgs {
  host?: string | core.StringOut;

  path?: string | core.StringOut;

  port?: string | core.StringOut;

  protocol?: string | core.StringOut;

  query?: string | core.StringOut;

  statusCode: string | core.StringOut;
}

export class Redirect extends core.Schema<RedirectArgs> {
  @core.attr(String)
  public host?: string | core.StringOut;

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

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

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

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

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

export interface AuthenticateCognitoArgs extends core.SchemaArgs {
  authenticationRequestExtraParams?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

  onUnauthenticatedRequest?: string | core.StringOut;

  scope?: string | core.StringOut;

  sessionCookieName?: string | core.StringOut;

  sessionTimeout?: number | core.NumberOut;

  userPoolArn: string | core.StringOut;

  userPoolClientId: string | core.StringOut;

  userPoolDomain: string | core.StringOut;
}

export class AuthenticateCognito extends core.Schema<AuthenticateCognitoArgs> {
  @core.attr(String, { kind: "map" })
  public authenticationRequestExtraParams?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

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

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

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

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

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

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

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

export interface AuthenticateOidcArgs extends core.SchemaArgs {
  authenticationRequestExtraParams?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

  authorizationEndpoint: string | core.StringOut;

  clientId: string | core.StringOut;

  clientSecret: string | core.StringOut;

  issuer: string | core.StringOut;

  onUnauthenticatedRequest?: string | core.StringOut;

  scope?: string | core.StringOut;

  sessionCookieName?: string | core.StringOut;

  sessionTimeout?: number | core.NumberOut;

  tokenEndpoint: string | core.StringOut;

  userInfoEndpoint: string | core.StringOut;
}

export class AuthenticateOidc extends core.Schema<AuthenticateOidcArgs> {
  @core.attr(String, { kind: "map" })
  public authenticationRequestExtraParams?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

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

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

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

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

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

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

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

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

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

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

export interface FixedResponseArgs extends core.SchemaArgs {
  contentType: string | core.StringOut;

  messageBody?: string | core.StringOut;

  statusCode?: string | core.StringOut;
}

export class FixedResponse extends core.Schema<FixedResponseArgs> {
  @core.attr(String)
  public contentType!: string | core.StringOut;

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

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

export interface TargetGroupArgs extends core.SchemaArgs {
  arn: string | core.StringOut;

  weight?: number | core.NumberOut;
}

export class TargetGroup extends core.Schema<TargetGroupArgs> {
  @core.attr(String)
  public arn!: string | core.StringOut;

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

export interface StickinessArgs extends core.SchemaArgs {
  duration: number | core.NumberOut;

  enabled?: boolean | core.BooleanOut;
}

export class Stickiness extends core.Schema<StickinessArgs> {
  @core.attr(Number)
  public duration!: number | core.NumberOut;

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

export interface ForwardArgs extends core.SchemaArgs {
  stickiness?: Stickiness;

  targetGroup: core.Array<TargetGroup> | core.ArrayOut<TargetGroup>;
}

export class Forward extends core.Schema<ForwardArgs> {
  @core.attr(Stickiness)
  public stickiness?: Stickiness;

  @core.attr(TargetGroup, { kind: "array" })
  public targetGroup!: core.Array<TargetGroup> | core.ArrayOut<TargetGroup>;
}

export interface DefaultActionArgs extends core.SchemaArgs {
  authenticateCognito?: AuthenticateCognito;

  authenticateOidc?: AuthenticateOidc;

  fixedResponse?: FixedResponse;

  forward?: Forward;

  order?: number | core.NumberOut;

  redirect?: Redirect;

  targetGroupArn?: string | core.StringOut;

  type: string | core.StringOut;
}

export class DefaultAction extends core.Schema<DefaultActionArgs> {
  @core.attr(AuthenticateCognito)
  public authenticateCognito?: AuthenticateCognito;

  @core.attr(AuthenticateOidc)
  public authenticateOidc?: AuthenticateOidc;

  @core.attr(FixedResponse)
  public fixedResponse?: FixedResponse;

  @core.attr(Forward)
  public forward?: Forward;

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

  @core.attr(Redirect)
  public redirect?: Redirect;

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

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

export interface LbListenerArgs extends core.ResourceArgs {
  alpnPolicy?: string | core.StringOut;

  certificateArn?: string | core.StringOut;

  defaultAction: core.Array<DefaultAction> | core.ArrayOut<DefaultAction>;

  loadBalancerArn: string | core.StringOut;

  port?: number | core.NumberOut;

  protocol?: string | core.StringOut;

  sslPolicy?: string | core.StringOut;

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

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

export class LbListener extends core.Resource<LbListenerArgs> {
  @core.attr(String)
  public alpnPolicy?: string | core.StringOut;

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

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

  @core.attr(DefaultAction, { kind: "array" })
  public defaultAction!:
    | core.Array<DefaultAction>
    | core.ArrayOut<DefaultAction>;

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

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

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

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

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

  @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>;

  constructor(name: string, args?: LbListenerArgs) {
    super(name, "aws_lb_listener", args);
  }

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