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

export interface OpenidConnectConfigArgs extends core.SchemaArgs {
  authTtl?: number | core.NumberOut;

  clientId?: string | core.StringOut;

  iatTtl?: number | core.NumberOut;

  issuer: string | core.StringOut;
}

export class OpenidConnectConfig extends core.Schema<OpenidConnectConfigArgs> {
  @core.attr(Number)
  public authTtl?: number | core.NumberOut;

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

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

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

export interface UserPoolConfigArgs extends core.SchemaArgs {
  appIdClientRegex?: string | core.StringOut;

  awsRegion?: string | core.StringOut;

  defaultAction: string | core.StringOut;

  userPoolId: string | core.StringOut;
}

export class UserPoolConfig extends core.Schema<UserPoolConfigArgs> {
  @core.attr(String)
  public appIdClientRegex?: string | core.StringOut;

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

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

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

export interface LambdaAuthorizerConfigArgs extends core.SchemaArgs {
  authorizerResultTtlInSeconds?: number | core.NumberOut;

  authorizerUri: string | core.StringOut;

  identityValidationExpression?: string | core.StringOut;
}

export class LambdaAuthorizerConfig extends core.Schema<LambdaAuthorizerConfigArgs> {
  @core.attr(Number)
  public authorizerResultTtlInSeconds?: number | core.NumberOut;

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

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

export interface AdditionalAuthenticationProviderUserPoolConfigArgs
  extends core.SchemaArgs {
  appIdClientRegex?: string | core.StringOut;

  awsRegion?: string | core.StringOut;

  userPoolId: string | core.StringOut;
}

export class AdditionalAuthenticationProviderUserPoolConfig extends core.Schema<AdditionalAuthenticationProviderUserPoolConfigArgs> {
  @core.attr(String)
  public appIdClientRegex?: string | core.StringOut;

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

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

export interface AdditionalAuthenticationProviderArgs extends core.SchemaArgs {
  authenticationType: string | core.StringOut;

  lambdaAuthorizerConfig?: LambdaAuthorizerConfig;

  openidConnectConfig?: OpenidConnectConfig;

  userPoolConfig?: AdditionalAuthenticationProviderUserPoolConfig;
}

export class AdditionalAuthenticationProvider extends core.Schema<AdditionalAuthenticationProviderArgs> {
  @core.attr(String)
  public authenticationType!: string | core.StringOut;

  @core.attr(LambdaAuthorizerConfig)
  public lambdaAuthorizerConfig?: LambdaAuthorizerConfig;

  @core.attr(OpenidConnectConfig)
  public openidConnectConfig?: OpenidConnectConfig;

  @core.attr(AdditionalAuthenticationProviderUserPoolConfig)
  public userPoolConfig?: AdditionalAuthenticationProviderUserPoolConfig;
}

export interface LogConfigArgs extends core.SchemaArgs {
  cloudwatchLogsRoleArn: string | core.StringOut;

  excludeVerboseContent?: boolean | core.BooleanOut;

  fieldLogLevel: string | core.StringOut;
}

export class LogConfig extends core.Schema<LogConfigArgs> {
  @core.attr(String)
  public cloudwatchLogsRoleArn!: string | core.StringOut;

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

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

export interface GraphqlApiArgs extends core.ResourceArgs {
  additionalAuthenticationProvider?:
    | core.Array<AdditionalAuthenticationProvider>
    | core.ArrayOut<AdditionalAuthenticationProvider>;

  authenticationType: string | core.StringOut;

  lambdaAuthorizerConfig?: LambdaAuthorizerConfig;

  logConfig?: LogConfig;

  name: string | core.StringOut;

  openidConnectConfig?: OpenidConnectConfig;

  schema?: string | core.StringOut;

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

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

  userPoolConfig?: UserPoolConfig;

  xrayEnabled?: boolean | core.BooleanOut;
}

export class GraphqlApi extends core.Resource<GraphqlApiArgs> {
  @core.attr(AdditionalAuthenticationProvider, { kind: "array" })
  public additionalAuthenticationProvider?:
    | core.Array<AdditionalAuthenticationProvider>
    | core.ArrayOut<AdditionalAuthenticationProvider>;

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

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

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

  @core.attr(LambdaAuthorizerConfig)
  public lambdaAuthorizerConfig?: LambdaAuthorizerConfig;

  @core.attr(LogConfig)
  public logConfig?: LogConfig;

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

  @core.attr(OpenidConnectConfig)
  public openidConnectConfig?: OpenidConnectConfig;

  @core.attr(String)
  public schema?: 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, { computed: true, kind: "map" })
  public uris!: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(UserPoolConfig)
  public userPoolConfig?: UserPoolConfig;

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

  constructor(name: string, args?: GraphqlApiArgs) {
    super(name, "aws_appsync_graphql_api", args);
  }

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