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

export interface CachingConfigArgs extends core.SchemaArgs {
  cachingKeys?: core.Array<string> | core.ArrayOut<core.StringOut>;

  ttl?: number | core.NumberOut;
}

export class CachingConfig extends core.Schema<CachingConfigArgs> {
  @core.attr(String, { kind: "array" })
  public cachingKeys?: core.Array<string> | core.ArrayOut<core.StringOut>;

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

export interface PipelineConfigArgs extends core.SchemaArgs {
  functions?: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export class PipelineConfig extends core.Schema<PipelineConfigArgs> {
  @core.attr(String, { kind: "array" })
  public functions?: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export interface LambdaConflictHandlerConfigArgs extends core.SchemaArgs {
  lambdaConflictHandlerArn?: string | core.StringOut;
}

export class LambdaConflictHandlerConfig extends core.Schema<LambdaConflictHandlerConfigArgs> {
  @core.attr(String)
  public lambdaConflictHandlerArn?: string | core.StringOut;
}

export interface SyncConfigArgs extends core.SchemaArgs {
  conflictDetection?: string | core.StringOut;

  conflictHandler?: string | core.StringOut;

  lambdaConflictHandlerConfig?: LambdaConflictHandlerConfig;
}

export class SyncConfig extends core.Schema<SyncConfigArgs> {
  @core.attr(String)
  public conflictDetection?: string | core.StringOut;

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

  @core.attr(LambdaConflictHandlerConfig)
  public lambdaConflictHandlerConfig?: LambdaConflictHandlerConfig;
}

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

  cachingConfig?: CachingConfig;

  dataSource?: string | core.StringOut;

  field: string | core.StringOut;

  kind?: string | core.StringOut;

  maxBatchSize?: number | core.NumberOut;

  pipelineConfig?: PipelineConfig;

  requestTemplate?: string | core.StringOut;

  responseTemplate?: string | core.StringOut;

  syncConfig?: SyncConfig;

  type: string | core.StringOut;
}

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

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

  @core.attr(CachingConfig)
  public cachingConfig?: CachingConfig;

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

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

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

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

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

  @core.attr(PipelineConfig)
  public pipelineConfig?: PipelineConfig;

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

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

  @core.attr(SyncConfig)
  public syncConfig?: SyncConfig;

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

  constructor(name: string, args?: ResolverArgs) {
    super(name, "aws_appsync_resolver", args);
  }

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