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

export interface CorsConfigurationArgs extends core.SchemaArgs {
  allowCredentials?: boolean | core.BooleanOut;

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

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

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

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

  maxAge?: number | core.NumberOut;
}

export class CorsConfiguration extends core.Schema<CorsConfigurationArgs> {
  @core.attr(Boolean)
  public allowCredentials?: boolean | core.BooleanOut;

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

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

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

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

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

export interface ApiArgs extends core.ResourceArgs {
  apiKeySelectionExpression?: string | core.StringOut;

  body?: string | core.StringOut;

  corsConfiguration?: CorsConfiguration;

  credentialsArn?: string | core.StringOut;

  description?: string | core.StringOut;

  disableExecuteApiEndpoint?: boolean | core.BooleanOut;

  failOnWarnings?: boolean | core.BooleanOut;

  name: string | core.StringOut;

  protocolType: string | core.StringOut;

  routeKey?: string | core.StringOut;

  routeSelectionExpression?: string | core.StringOut;

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

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

  target?: string | core.StringOut;

  version?: string | core.StringOut;
}

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

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

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

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

  @core.attr(CorsConfiguration)
  public corsConfiguration?: CorsConfiguration;

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

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

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

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

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

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

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

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

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

  @core.attr(String)
  public routeSelectionExpression?: 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>;

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

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

  constructor(name: string, args?: ApiArgs) {
    super(name, "aws_apigatewayv2_api", args);
  }

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