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

export interface RotationRulesArgs extends core.SchemaArgs {
  automaticallyAfterDays: number | core.NumberOut;
}

export class RotationRules extends core.Schema<RotationRulesArgs> {
  @core.attr(Number)
  public automaticallyAfterDays!: number | core.NumberOut;
}

export interface SecretRotationArgs extends core.ResourceArgs {
  rotationLambdaArn: string | core.StringOut;

  rotationRules: RotationRules;

  secretId: string | core.StringOut;

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

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

  @core.attr(Boolean, { computed: true })
  public rotationEnabled!: boolean | core.BooleanOut;

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

  @core.attr(RotationRules)
  public rotationRules!: RotationRules;

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

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

  constructor(name: string, args?: SecretRotationArgs) {
    super(name, "aws_secretsmanager_secret_rotation", args);
  }

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