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

export interface RoutingConfigArgs extends core.SchemaArgs {
  additionalVersionWeights?:
    | core.Map<string, number>
    | core.MapOut<core.NumberOut>;
}

export class RoutingConfig extends core.Schema<RoutingConfigArgs> {
  @core.attr(Number, { kind: "map" })
  public additionalVersionWeights?:
    | core.Map<string, number>
    | core.MapOut<core.NumberOut>;
}

export interface AliasArgs extends core.ResourceArgs {
  description?: string | core.StringOut;

  functionName: string | core.StringOut;

  functionVersion: string | core.StringOut;

  name: string | core.StringOut;

  routingConfig?: RoutingConfig;
}

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

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

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

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

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

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

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

  @core.attr(RoutingConfig)
  public routingConfig?: RoutingConfig;

  constructor(name: string, args?: AliasArgs) {
    super(name, "aws_lambda_alias", args);
  }

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