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

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

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

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

  @core.attr(String, { kind: "map" })
  public encryptionContextSubset?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;
}

export interface GrantArgs extends core.ResourceArgs {
  constraints?: core.Array<Constraints> | core.ArrayOut<Constraints>;

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

  granteePrincipal: string | core.StringOut;

  keyId: string | core.StringOut;

  name?: string | core.StringOut;

  operations: core.Array<string> | core.ArrayOut<core.StringOut>;

  retireOnDelete?: boolean | core.BooleanOut;

  retiringPrincipal?: string | core.StringOut;
}

export class Grant extends core.Resource<GrantArgs> {
  @core.attr(Constraints, { kind: "array" })
  public constraints?: core.Array<Constraints> | core.ArrayOut<Constraints>;

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

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

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

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

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

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

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

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

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

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

  constructor(name: string, args?: GrantArgs) {
    super(name, "aws_kms_grant", args);
  }

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