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

export interface IngressArgs extends core.SchemaArgs {
  cidr?: string | core.StringOut;

  securityGroupName?: string | core.StringOut;

  securityGroupOwnerId?: string | core.StringOut;
}

export class Ingress extends core.Schema<IngressArgs> {
  @core.attr(String)
  public cidr?: string | core.StringOut;

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

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

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

  ingress: core.Array<Ingress> | core.ArrayOut<Ingress>;

  name: string | core.StringOut;
}

export class SecurityGroup extends core.Resource<SecurityGroupArgs> {
  @core.attr(String)
  public description?: string | core.StringOut;

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

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

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

  constructor(name: string, args?: SecurityGroupArgs) {
    super(name, "aws_redshift_security_group", args);
  }

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