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, { computed: true })
  public allowCredentials!: boolean | core.BooleanOut;

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

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

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

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

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

export interface DsFunctionUrlArgs {
  functionName: string | core.StringOut;

  qualifier?: string | core.StringOut;
}

export class DsFunctionUrl extends core.Data<DsFunctionUrlArgs> {
  @core.attr(String, { computed: true })
  public authorizationType!: string | core.StringOut;

  @core.attr(Cors, { computed: true, kind: "array" })
  public cors!: core.Array<Cors> | core.ArrayOut<Cors>;

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

  @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, { computed: true })
  public lastModifiedTime!: 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?: DsFunctionUrlArgs) {
    super(name, "aws_lambda_function_url", args);
  }

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