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

export interface CorsArgs 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 Cors extends core.Schema<CorsArgs> {
  @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 FunctionUrlArgs extends core.ResourceArgs {
  authorizationType: string | core.StringOut;

  cors?: Cors;

  functionName: string | core.StringOut;

  qualifier?: string | core.StringOut;
}

export class FunctionUrl extends core.Resource<FunctionUrlArgs> {
  @core.attr(String)
  public authorizationType!: string | core.StringOut;

  @core.attr(Cors)
  public cors?: Cors;

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

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

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

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

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

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

  constructor(name: string, args?: FunctionUrlArgs) {
    super(name, "aws_lambda_function_url", args);
  }

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