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

export interface ElasticsearchConfigArgs extends core.SchemaArgs {
  endpoint: string | core.StringOut;

  region?: string | core.StringOut;
}

export class ElasticsearchConfig extends core.Schema<ElasticsearchConfigArgs> {
  @core.attr(String)
  public endpoint!: string | core.StringOut;

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

export interface DeltaSyncConfigArgs extends core.SchemaArgs {
  baseTableTtl?: number | core.NumberOut;

  deltaSyncTableName: string | core.StringOut;

  deltaSyncTableTtl?: number | core.NumberOut;
}

export class DeltaSyncConfig extends core.Schema<DeltaSyncConfigArgs> {
  @core.attr(Number)
  public baseTableTtl?: number | core.NumberOut;

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

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

export interface DynamodbConfigArgs extends core.SchemaArgs {
  deltaSyncConfig?: DeltaSyncConfig;

  region?: string | core.StringOut;

  tableName: string | core.StringOut;

  useCallerCredentials?: boolean | core.BooleanOut;

  versioned?: boolean | core.BooleanOut;
}

export class DynamodbConfig extends core.Schema<DynamodbConfigArgs> {
  @core.attr(DeltaSyncConfig)
  public deltaSyncConfig?: DeltaSyncConfig;

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

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

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

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

export interface AwsIamConfigArgs extends core.SchemaArgs {
  signingRegion?: string | core.StringOut;

  signingServiceName?: string | core.StringOut;
}

export class AwsIamConfig extends core.Schema<AwsIamConfigArgs> {
  @core.attr(String)
  public signingRegion?: string | core.StringOut;

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

export interface AuthorizationConfigArgs extends core.SchemaArgs {
  authorizationType?: string | core.StringOut;

  awsIamConfig?: AwsIamConfig;
}

export class AuthorizationConfig extends core.Schema<AuthorizationConfigArgs> {
  @core.attr(String)
  public authorizationType?: string | core.StringOut;

  @core.attr(AwsIamConfig)
  public awsIamConfig?: AwsIamConfig;
}

export interface HttpConfigArgs extends core.SchemaArgs {
  authorizationConfig?: AuthorizationConfig;

  endpoint: string | core.StringOut;
}

export class HttpConfig extends core.Schema<HttpConfigArgs> {
  @core.attr(AuthorizationConfig)
  public authorizationConfig?: AuthorizationConfig;

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

export interface LambdaConfigArgs extends core.SchemaArgs {
  functionArn: string | core.StringOut;
}

export class LambdaConfig extends core.Schema<LambdaConfigArgs> {
  @core.attr(String)
  public functionArn!: string | core.StringOut;
}

export interface HttpEndpointConfigArgs extends core.SchemaArgs {
  awsSecretStoreArn: string | core.StringOut;

  databaseName?: string | core.StringOut;

  dbClusterIdentifier: string | core.StringOut;

  region?: string | core.StringOut;

  schema?: string | core.StringOut;
}

export class HttpEndpointConfig extends core.Schema<HttpEndpointConfigArgs> {
  @core.attr(String)
  public awsSecretStoreArn!: string | core.StringOut;

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

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

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

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

export interface RelationalDatabaseConfigArgs extends core.SchemaArgs {
  httpEndpointConfig?: HttpEndpointConfig;

  sourceType?: string | core.StringOut;
}

export class RelationalDatabaseConfig extends core.Schema<RelationalDatabaseConfigArgs> {
  @core.attr(HttpEndpointConfig)
  public httpEndpointConfig?: HttpEndpointConfig;

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

export interface DatasourceArgs extends core.ResourceArgs {
  apiId: string | core.StringOut;

  description?: string | core.StringOut;

  dynamodbConfig?: DynamodbConfig;

  elasticsearchConfig?: ElasticsearchConfig;

  httpConfig?: HttpConfig;

  lambdaConfig?: LambdaConfig;

  name: string | core.StringOut;

  relationalDatabaseConfig?: RelationalDatabaseConfig;

  serviceRoleArn?: string | core.StringOut;

  type: string | core.StringOut;
}

export class Datasource extends core.Resource<DatasourceArgs> {
  @core.attr(String)
  public apiId!: string | core.StringOut;

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

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

  @core.attr(DynamodbConfig)
  public dynamodbConfig?: DynamodbConfig;

  @core.attr(ElasticsearchConfig)
  public elasticsearchConfig?: ElasticsearchConfig;

  @core.attr(HttpConfig)
  public httpConfig?: HttpConfig;

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

  @core.attr(LambdaConfig)
  public lambdaConfig?: LambdaConfig;

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

  @core.attr(RelationalDatabaseConfig)
  public relationalDatabaseConfig?: RelationalDatabaseConfig;

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

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

  constructor(name: string, args?: DatasourceArgs) {
    super(name, "aws_appsync_datasource", args);
  }

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