import { env } from "@/config/env";
import { BootstrapSesInfraUseCase } from "@/modules/domains/use-cases/bootstrap-ses-infra-use-case";
import { SesInfraBootstrapperImpl } from "@/modules/domains/use-cases/ses-infra-bootstrapper-impl";

async function main() {
  if (!env.appBaseUrl) {
    throw new Error("APP_BASE_URL não está definida nas variáveis de ambiente");
  }

  const useCase = new BootstrapSesInfraUseCase(new SesInfraBootstrapperImpl());
  const result = await useCase.execute({
    configurationSetName: env.sesConfigurationSet,
    snsTopicName: env.sesSnsTopicName,
    webhookEndpoint: `${env.appBaseUrl}/api/webhooks/ses`,
  });

  console.log("Infraestrutura SES provisionada:", result);
}

main()
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
