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

export interface PortInfoArgs extends core.SchemaArgs {
  cidrs?: core.Array<string> | core.ArrayOut<core.StringOut>;

  fromPort: number | core.NumberOut;

  protocol: string | core.StringOut;

  toPort: number | core.NumberOut;
}

export class PortInfo extends core.Schema<PortInfoArgs> {
  @core.attr(String, { computed: true, kind: "array" })
  public cidrs?: core.Array<string> | core.ArrayOut<core.StringOut>;

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

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

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

export interface InstancePublicPortsArgs extends core.ResourceArgs {
  instanceName: string | core.StringOut;

  portInfo: core.Array<PortInfo> | core.ArrayOut<PortInfo>;
}

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

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

  @core.attr(PortInfo, { kind: "array" })
  public portInfo!: core.Array<PortInfo> | core.ArrayOut<PortInfo>;

  constructor(name: string, args?: InstancePublicPortsArgs) {
    super(name, "aws_lightsail_instance_public_ports", args);
  }

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