import * as cdk from 'aws-cdk-lib';
import * as sns from 'aws-cdk-lib/aws-sns';
import { Construct } from 'constructs';
import { EmailPipelineConstruct } from './constructs/email-pipeline';
import { SocketModeConstruct } from './constructs/socket-mode';
export class ExecAideStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Shared cross-stack site-alerts SNS topic for all CloudWatch ALARM actions.
// Managed by seahaven-account-baseline and encrypted with the
// alias/seahaven-alarm-topics CMK (CloudWatch cannot publish to topics using
// alias/aws/sns — silent failure). Imported ONCE here and injected into both
// constructs via props, the same way the DynamoDB table is wired through.
const alarmTopic = sns.Topic.fromTopicArn(
this,
'SiteAlerts',
`arn:aws:sns:${this.region}:${this.account}:site-alerts`,
);
const emailPipeline = new EmailPipelineConstruct(this, 'EmailPipeline', {
alarmTopic,
});
new SocketModeConstruct(this, 'SocketMode', {
table: emailPipeline.table,
conversationFnArn: emailPipeline.conversationFn.functionArn,
new cdk.CfnOutput(this, 'TableName', {
value: emailPipeline.table.tableName,
description: 'DynamoDB table name',
}