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

export interface ReplicaArgs extends core.SchemaArgs {
  regionName: string | core.StringOut;
}

export class Replica extends core.Schema<ReplicaArgs> {
  @core.attr(String)
  public regionName!: string | core.StringOut;
}

export interface GlobalTableArgs extends core.ResourceArgs {
  name: string | core.StringOut;

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

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

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

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

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

  constructor(name: string, args?: GlobalTableArgs) {
    super(name, "aws_dynamodb_global_table", args);
  }

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