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

export interface SecretArgs extends core.SchemaArgs {
  context?: core.Map<string, string> | core.MapOut<core.StringOut>;

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

  name: string | core.StringOut;

  payload: string | core.StringOut;
}

export class Secret extends core.Schema<SecretArgs> {
  @core.attr(String, { kind: "map" })
  public context?: core.Map<string, string> | core.MapOut<core.StringOut>;

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

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

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

export interface DsSecretsArgs {
  secret: core.Array<Secret> | core.ArrayOut<Secret>;
}

export class DsSecrets extends core.Data<DsSecretsArgs> {
  @core.attr(String, { computed: true })
  public id!: string | core.StringOut;

  @core.attr(String, { computed: true, kind: "map" })
  public plaintext!: core.Map<string, string> | core.MapOut<core.StringOut>;

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

  constructor(name: string, args?: DsSecretsArgs) {
    super(name, "aws_kms_secrets", args);
  }

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