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

export interface MetricTransformationArgs extends core.SchemaArgs {
  defaultValue?: string | core.StringOut;

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

  name: string | core.StringOut;

  namespace: string | core.StringOut;

  unit?: string | core.StringOut;

  value: string | core.StringOut;
}

export class MetricTransformation extends core.Schema<MetricTransformationArgs> {
  @core.attr(String)
  public defaultValue?: string | core.StringOut;

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

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

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

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

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

export interface LogMetricFilterArgs extends core.ResourceArgs {
  logGroupName: string | core.StringOut;

  metricTransformation: MetricTransformation;

  name: string | core.StringOut;

  pattern: string | core.StringOut;
}

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

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

  @core.attr(MetricTransformation)
  public metricTransformation!: MetricTransformation;

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

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

  constructor(name: string, args?: LogMetricFilterArgs) {
    super(name, "aws_cloudwatch_log_metric_filter", args);
  }

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