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

export interface OnFailureArgs extends core.SchemaArgs {
  destinationArn: string | core.StringOut;
}

export class OnFailure extends core.Schema<OnFailureArgs> {
  @core.attr(String)
  public destinationArn!: string | core.StringOut;
}

export interface DestinationConfigArgs extends core.SchemaArgs {
  onFailure?: OnFailure;
}

export class DestinationConfig extends core.Schema<DestinationConfigArgs> {
  @core.attr(OnFailure)
  public onFailure?: OnFailure;
}

export interface SelfManagedEventSourceArgs extends core.SchemaArgs {
  endpoints: core.Map<string, string> | core.MapOut<core.StringOut>;
}

export class SelfManagedEventSource extends core.Schema<SelfManagedEventSourceArgs> {
  @core.attr(String, { kind: "map" })
  public endpoints!: core.Map<string, string> | core.MapOut<core.StringOut>;
}

export interface SourceAccessConfigurationArgs extends core.SchemaArgs {
  type: string | core.StringOut;

  uri: string | core.StringOut;
}

export class SourceAccessConfiguration extends core.Schema<SourceAccessConfigurationArgs> {
  @core.attr(String)
  public type!: string | core.StringOut;

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

export interface FilterArgs extends core.SchemaArgs {
  pattern?: string | core.StringOut;
}

export class Filter extends core.Schema<FilterArgs> {
  @core.attr(String)
  public pattern?: string | core.StringOut;
}

export interface FilterCriteriaArgs extends core.SchemaArgs {
  filter?: core.Array<Filter> | core.ArrayOut<Filter>;
}

export class FilterCriteria extends core.Schema<FilterCriteriaArgs> {
  @core.attr(Filter, { kind: "array" })
  public filter?: core.Array<Filter> | core.ArrayOut<Filter>;
}

export interface EventSourceMappingArgs extends core.ResourceArgs {
  batchSize?: number | core.NumberOut;

  bisectBatchOnFunctionError?: boolean | core.BooleanOut;

  destinationConfig?: DestinationConfig;

  enabled?: boolean | core.BooleanOut;

  eventSourceArn?: string | core.StringOut;

  filterCriteria?: FilterCriteria;

  functionName: string | core.StringOut;

  functionResponseTypes?: core.Array<string> | core.ArrayOut<core.StringOut>;

  maximumBatchingWindowInSeconds?: number | core.NumberOut;

  maximumRecordAgeInSeconds?: number | core.NumberOut;

  maximumRetryAttempts?: number | core.NumberOut;

  parallelizationFactor?: number | core.NumberOut;

  queues?: core.Array<string> | core.ArrayOut<core.StringOut>;

  selfManagedEventSource?: SelfManagedEventSource;

  sourceAccessConfiguration?:
    | core.Array<SourceAccessConfiguration>
    | core.ArrayOut<SourceAccessConfiguration>;

  startingPosition?: string | core.StringOut;

  startingPositionTimestamp?: string | core.StringOut;

  topics?: core.Array<string> | core.ArrayOut<core.StringOut>;

  tumblingWindowInSeconds?: number | core.NumberOut;
}

export class EventSourceMapping extends core.Resource<EventSourceMappingArgs> {
  @core.attr(Number)
  public batchSize?: number | core.NumberOut;

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

  @core.attr(DestinationConfig)
  public destinationConfig?: DestinationConfig;

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

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

  @core.attr(FilterCriteria)
  public filterCriteria?: FilterCriteria;

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

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

  @core.attr(String, { kind: "array" })
  public functionResponseTypes?:
    | core.Array<string>
    | core.ArrayOut<core.StringOut>;

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

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

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

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

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

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

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

  @core.attr(String, { kind: "array" })
  public queues?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(SelfManagedEventSource)
  public selfManagedEventSource?: SelfManagedEventSource;

  @core.attr(SourceAccessConfiguration, { kind: "array" })
  public sourceAccessConfiguration?:
    | core.Array<SourceAccessConfiguration>
    | core.ArrayOut<SourceAccessConfiguration>;

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

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

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

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

  @core.attr(String, { kind: "array" })
  public topics?: core.Array<string> | core.ArrayOut<core.StringOut>;

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

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

  constructor(name: string, args?: EventSourceMappingArgs) {
    super(name, "aws_lambda_event_source_mapping", args);
  }

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