import * as cdk from "aws-cdk-lib";

export function generateTemplateBody<T extends cdk.StackProps>(Stack: typeof cdk.Stack, props: T): string {
  const app = new cdk.App();
  const stack = new Stack(app, "Stack", {
    ...props,
    synthesizer: new cdk.DefaultStackSynthesizer({
      generateBootstrapVersionRule: false,
    }),
  });
  return JSON.stringify(app.synth().getStackByName(stack.stackName).template);
}

export const getLambdaArchitecture = () => {
  return process.arch == "arm64" ? cdk.aws_lambda.Architecture.ARM_64 : cdk.aws_lambda.Architecture.X86_64;
};
