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

export interface LocalSecondaryIndexArgs extends core.SchemaArgs {
  name: string | core.StringOut;

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

  projectionType: string | core.StringOut;

  rangeKey: string | core.StringOut;
}

export class LocalSecondaryIndex extends core.Schema<LocalSecondaryIndexArgs> {
  @core.attr(String)
  public name!: string | core.StringOut;

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

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

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

export interface PointInTimeRecoveryArgs extends core.SchemaArgs {
  enabled: boolean | core.BooleanOut;
}

export class PointInTimeRecovery extends core.Schema<PointInTimeRecoveryArgs> {
  @core.attr(Boolean)
  public enabled!: boolean | core.BooleanOut;
}

export interface TtlArgs extends core.SchemaArgs {
  attributeName: string | core.StringOut;

  enabled?: boolean | core.BooleanOut;
}

export class Ttl extends core.Schema<TtlArgs> {
  @core.attr(String)
  public attributeName!: string | core.StringOut;

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

export interface AttributeArgs extends core.SchemaArgs {
  name: string | core.StringOut;

  type: string | core.StringOut;
}

export class Attribute extends core.Schema<AttributeArgs> {
  @core.attr(String)
  public name!: string | core.StringOut;

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

export interface ReplicaArgs extends core.SchemaArgs {
  kmsKeyArn?: string | core.StringOut;

  pointInTimeRecovery?: boolean | core.BooleanOut;

  propagateTags?: boolean | core.BooleanOut;

  regionName: string | core.StringOut;
}

export class Replica extends core.Schema<ReplicaArgs> {
  @core.attr(String, { computed: true })
  public kmsKeyArn?: string | core.StringOut;

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

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

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

export interface GlobalSecondaryIndexArgs extends core.SchemaArgs {
  hashKey: string | core.StringOut;

  name: string | core.StringOut;

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

  projectionType: string | core.StringOut;

  rangeKey?: string | core.StringOut;

  readCapacity?: number | core.NumberOut;

  writeCapacity?: number | core.NumberOut;
}

export class GlobalSecondaryIndex extends core.Schema<GlobalSecondaryIndexArgs> {
  @core.attr(String)
  public hashKey!: string | core.StringOut;

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

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

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

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

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

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

export interface ServerSideEncryptionArgs extends core.SchemaArgs {
  enabled: boolean | core.BooleanOut;

  kmsKeyArn?: string | core.StringOut;
}

export class ServerSideEncryption extends core.Schema<ServerSideEncryptionArgs> {
  @core.attr(Boolean)
  public enabled!: boolean | core.BooleanOut;

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

export interface TableArgs extends core.ResourceArgs {
  attribute?: core.Array<Attribute> | core.ArrayOut<Attribute>;

  billingMode?: string | core.StringOut;

  globalSecondaryIndex?:
    | core.Array<GlobalSecondaryIndex>
    | core.ArrayOut<GlobalSecondaryIndex>;

  hashKey?: string | core.StringOut;

  localSecondaryIndex?:
    | core.Array<LocalSecondaryIndex>
    | core.ArrayOut<LocalSecondaryIndex>;

  name: string | core.StringOut;

  pointInTimeRecovery?: PointInTimeRecovery;

  rangeKey?: string | core.StringOut;

  readCapacity?: number | core.NumberOut;

  replica?: core.Array<Replica> | core.ArrayOut<Replica>;

  restoreDateTime?: string | core.StringOut;

  restoreSourceName?: string | core.StringOut;

  restoreToLatestTime?: boolean | core.BooleanOut;

  serverSideEncryption?: ServerSideEncryption;

  streamEnabled?: boolean | core.BooleanOut;

  streamViewType?: string | core.StringOut;

  tableClass?: string | core.StringOut;

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

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

  ttl?: Ttl;

  writeCapacity?: number | core.NumberOut;
}

export class Table extends core.Resource<TableArgs> {
  @core.attr(String, { computed: true })
  public arn!: string | core.StringOut;

  @core.attr(Attribute, { computed: true, kind: "array" })
  public attribute?: core.Array<Attribute> | core.ArrayOut<Attribute>;

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

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

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

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

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

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

  @core.attr(PointInTimeRecovery, { computed: true })
  public pointInTimeRecovery?: PointInTimeRecovery;

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

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

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

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

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

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

  @core.attr(ServerSideEncryption, { computed: true })
  public serverSideEncryption?: ServerSideEncryption;

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

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

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

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

  @core.attr(String)
  public tableClass?: 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(Ttl, { computed: true })
  public ttl?: Ttl;

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

  constructor(name: string, args?: TableArgs) {
    super(name, "aws_dynamodb_table", args);
  }

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