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

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

  negated: boolean | core.BooleanOut;

  type: string | core.StringOut;
}

export class Predicates extends core.Schema<PredicatesArgs> {
  @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;

  predicates?: core.Array<Predicates> | core.ArrayOut<Predicates>;

  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(Predicates, { kind: "array" })
  public predicates?: core.Array<Predicates> | core.ArrayOut<Predicates>;

  @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_waf_rate_based_rule", args);
  }

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