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

export interface PredicateArgs extends core.SchemaArgs {
  dataId: string | core.StringOut;

  negated: boolean | core.BooleanOut;

  type: string | core.StringOut;
}

export class Predicate extends core.Schema<PredicateArgs> {
  @core.attr(String)
  public dataId!: string | core.StringOut;

  @core.attr(Boolean)
  public negated!: boolean | core.BooleanOut;

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

export interface RateBasedRuleArgs extends core.ResourceArgs {
  metricName: string | core.StringOut;

  name: string | core.StringOut;

  predicate?: core.Array<Predicate> | core.ArrayOut<Predicate>;

  rateKey: string | core.StringOut;

  rateLimit: number | core.NumberOut;

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

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

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

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

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

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

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

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

  @core.attr(Number)
  public rateLimit!: number | core.NumberOut;

  @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>;

  constructor(name: string, args?: RateBasedRuleArgs) {
    super(name, "aws_wafregional_rate_based_rule", args);
  }

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