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

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

  metricName: string | core.StringOut;

  namespace?: string | core.StringOut;

  period: number | core.NumberOut;

  stat: string | core.StringOut;

  unit?: string | core.StringOut;
}

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

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

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

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

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

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

export interface MetricQueryArgs extends core.SchemaArgs {
  accountId?: string | core.StringOut;

  expression?: string | core.StringOut;

  id: string | core.StringOut;

  label?: string | core.StringOut;

  metric?: Metric;

  returnData?: boolean | core.BooleanOut;
}

export class MetricQuery extends core.Schema<MetricQueryArgs> {
  @core.attr(String)
  public accountId?: string | core.StringOut;

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

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

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

  @core.attr(Metric)
  public metric?: Metric;

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

export interface MetricAlarmArgs extends core.ResourceArgs {
  actionsEnabled?: boolean | core.BooleanOut;

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

  alarmDescription?: string | core.StringOut;

  alarmName: string | core.StringOut;

  comparisonOperator: string | core.StringOut;

  datapointsToAlarm?: number | core.NumberOut;

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

  evaluateLowSampleCountPercentiles?: string | core.StringOut;

  evaluationPeriods: number | core.NumberOut;

  extendedStatistic?: string | core.StringOut;

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

  metricName?: string | core.StringOut;

  metricQuery?: core.Array<MetricQuery> | core.ArrayOut<MetricQuery>;

  namespace?: string | core.StringOut;

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

  period?: number | core.NumberOut;

  statistic?: string | core.StringOut;

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

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

  threshold?: number | core.NumberOut;

  thresholdMetricId?: string | core.StringOut;

  treatMissingData?: string | core.StringOut;

  unit?: string | core.StringOut;
}

export class MetricAlarm extends core.Resource<MetricAlarmArgs> {
  @core.attr(Boolean)
  public actionsEnabled?: boolean | core.BooleanOut;

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

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

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

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

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

  @core.attr(Number)
  public datapointsToAlarm?: number | core.NumberOut;

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

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

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

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

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

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

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

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

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

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

  @core.attr(Number)
  public period?: number | core.NumberOut;

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

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

  @core.attr(Number)
  public threshold?: number | core.NumberOut;

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

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

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

  constructor(name: string, args?: MetricAlarmArgs) {
    super(name, "aws_cloudwatch_metric_alarm", args);
  }

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