import * as cdk from "aws-cdk-lib";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import { Construct } from "constructs";
import { Context } from "../lib/context";

interface StackProps extends cdk.StackProps {
  readonly stage: string;
  readonly networkProps: Context["networkProps"];
}

export class NetworkStack extends cdk.Stack {
  public readonly vpc: ec2.IVpc;

  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, props);

    const { stage, networkProps } = props;

    this.vpc = new ec2.Vpc(this, "Vpc", {
      vpcName: `${stage}-vpc`,
      natGateways: networkProps.natGatewayNum,
      maxAzs: networkProps.maxAzs,
    });
  }
}
