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

export interface StepAdjustmentArgs extends core.SchemaArgs {
  metricIntervalLowerBound?: string | core.StringOut;

  metricIntervalUpperBound?: string | core.StringOut;

  scalingAdjustment: number | core.NumberOut;
}

export class StepAdjustment extends core.Schema<StepAdjustmentArgs> {
  @core.attr(String)
  public metricIntervalLowerBound?: string | core.StringOut;

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

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

export interface StepScalingPolicyConfigurationArgs extends core.SchemaArgs {
  adjustmentType?: string | core.StringOut;

  cooldown?: number | core.NumberOut;

  metricAggregationType?: string | core.StringOut;

  minAdjustmentMagnitude?: number | core.NumberOut;

  stepAdjustment?: core.Array<StepAdjustment> | core.ArrayOut<StepAdjustment>;
}

export class StepScalingPolicyConfiguration extends core.Schema<StepScalingPolicyConfigurationArgs> {
  @core.attr(String)
  public adjustmentType?: string | core.StringOut;

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

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

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

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

export interface DimensionsArgs extends core.SchemaArgs {
  name: string | core.StringOut;

  value: string | core.StringOut;
}

export class Dimensions extends core.Schema<DimensionsArgs> {
  @core.attr(String)
  public name!: string | core.StringOut;

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

export interface CustomizedMetricSpecificationArgs extends core.SchemaArgs {
  dimensions?: core.Array<Dimensions> | core.ArrayOut<Dimensions>;

  metricName: string | core.StringOut;

  namespace: string | core.StringOut;

  statistic: string | core.StringOut;

  unit?: string | core.StringOut;
}

export class CustomizedMetricSpecification extends core.Schema<CustomizedMetricSpecificationArgs> {
  @core.attr(Dimensions, { kind: "array" })
  public dimensions?: core.Array<Dimensions> | core.ArrayOut<Dimensions>;

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

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

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

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

export interface PredefinedMetricSpecificationArgs extends core.SchemaArgs {
  predefinedMetricType: string | core.StringOut;

  resourceLabel?: string | core.StringOut;
}

export class PredefinedMetricSpecification extends core.Schema<PredefinedMetricSpecificationArgs> {
  @core.attr(String)
  public predefinedMetricType!: string | core.StringOut;

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

export interface TargetTrackingScalingPolicyConfigurationArgs
  extends core.SchemaArgs {
  customizedMetricSpecification?: CustomizedMetricSpecification;

  disableScaleIn?: boolean | core.BooleanOut;

  predefinedMetricSpecification?: PredefinedMetricSpecification;

  scaleInCooldown?: number | core.NumberOut;

  scaleOutCooldown?: number | core.NumberOut;

  targetValue: number | core.NumberOut;
}

export class TargetTrackingScalingPolicyConfiguration extends core.Schema<TargetTrackingScalingPolicyConfigurationArgs> {
  @core.attr(CustomizedMetricSpecification)
  public customizedMetricSpecification?: CustomizedMetricSpecification;

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

  @core.attr(PredefinedMetricSpecification)
  public predefinedMetricSpecification?: PredefinedMetricSpecification;

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

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

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

export interface AppautoscalingPolicyArgs extends core.ResourceArgs {
  name: string | core.StringOut;

  policyType?: string | core.StringOut;

  resourceId: string | core.StringOut;

  scalableDimension: string | core.StringOut;

  serviceNamespace: string | core.StringOut;

  stepScalingPolicyConfiguration?: StepScalingPolicyConfiguration;

  targetTrackingScalingPolicyConfiguration?: TargetTrackingScalingPolicyConfiguration;
}

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

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

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

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

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

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

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

  @core.attr(StepScalingPolicyConfiguration)
  public stepScalingPolicyConfiguration?: StepScalingPolicyConfiguration;

  @core.attr(TargetTrackingScalingPolicyConfiguration)
  public targetTrackingScalingPolicyConfiguration?: TargetTrackingScalingPolicyConfiguration;

  constructor(name: string, args?: AppautoscalingPolicyArgs) {
    super(name, "aws_appautoscaling_policy", args);
  }

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