import { integrationScope } from "../types" import type { IntegrationAccountRequirement, TriggerDefinition } from "../types" const WEBHOOK_ACCOUNT = { connectionOptions: [ { connectionMethodId: "oauth", requiredScopes: [integrationScope.and("ads_management")], }, ], serviceId: "meta-ads", } as const satisfies IntegrationAccountRequirement const LEAD_ACCOUNT = { connectionOptions: [ { connectionMethodId: "oauth", requiredScopes: [ integrationScope.and( "ads_management", "pages_manage_metadata", "pages_read_engagement", "pages_show_list", ), ], }, ], serviceId: "meta-ads", } as const satisfies IntegrationAccountRequirement export const metaAdsTriggerDefinitions = { metaAdsAdEffectiveStatusChanged: { account: WEBHOOK_ACCOUNT, type: "meta-ads.ad.effectiveStatusChanged", }, metaAdsAdObjectIssuesChanged: { account: WEBHOOK_ACCOUNT, type: "meta-ads.adObject.issuesChanged", }, metaAdsAdObjectProcessingCompleted: { account: WEBHOOK_ACCOUNT, type: "meta-ads.adObject.processingCompleted", }, metaAdsAdRecommendation: { account: WEBHOOK_ACCOUNT, type: "meta-ads.ad.recommendation", }, metaAdsAdSetEffectiveStatusChanged: { account: WEBHOOK_ACCOUNT, type: "meta-ads.adSet.effectiveStatusChanged", }, metaAdsCampaignEffectiveStatusChanged: { account: WEBHOOK_ACCOUNT, type: "meta-ads.campaign.effectiveStatusChanged", }, metaAdsCreativeFatigueChanged: { account: WEBHOOK_ACCOUNT, type: "meta-ads.creativeFatigue.changed", }, metaAdsEvent: { account: WEBHOOK_ACCOUNT, type: "meta-ads.event" }, metaAdsLeadCreated: { account: LEAD_ACCOUNT, type: "meta-ads.lead.created", }, metaAdsObjectCreated: { account: WEBHOOK_ACCOUNT, type: "meta-ads.object.created", }, metaAdsObjectUpdated: { account: WEBHOOK_ACCOUNT, type: "meta-ads.object.updated", }, metaAdsInsightsUpdated: { account: WEBHOOK_ACCOUNT, type: "meta-ads.insights.updated", }, metaAdsInsightsMilestoneReached: { account: WEBHOOK_ACCOUNT, type: "meta-ads.insights.milestoneReached", }, } as const satisfies Record