import { MailMessage } from '@platform-modules/mail';
import { MarketingContact, MarketingList, Campaign, CampaignStats, ComplianceStore, MarketingAdapter } from './index.js';

type SelfManagedMail = {
    send(msg: MailMessage): Promise<{
        id: string;
        provider: string;
    }>;
};
type SelfManagedStore = {
    upsertContact(contact: MarketingContact, listId?: string): Promise<void>;
    removeContact(email: string, listId?: string): Promise<void>;
    tagContact(email: string, tag: string): Promise<void>;
    createList(name: string): Promise<MarketingList>;
    lists(): Promise<MarketingList[]>;
    saveCampaign(campaign: Campaign): Promise<void>;
    getCampaign(id: string): Promise<Campaign | null>;
    getListRecipients(listIds: string[]): Promise<string[]>;
    recordOpen(campaignId: string, email: string): Promise<void>;
    recordClick(campaignId: string, email: string, url: string): Promise<void>;
    getStats(campaignId: string): Promise<CampaignStats>;
    createSegment(def: {
        name: string;
        listId: string;
        filter: SegmentFilter;
    }): Promise<Segment>;
    listSegments(listId?: string): Promise<Segment[]>;
    scheduleCampaign(campaignId: string, scheduledAt: string): Promise<void>;
};
type SegmentFilter = {
    tag?: string;
    attributeKey?: string;
    attributeValue?: string;
};
type Segment = {
    id: string;
    name: string;
    listId: string;
    filter: SegmentFilter;
};
type SelfManagedCreds = {
    from: string;
    mail: SelfManagedMail;
    store: SelfManagedStore;
    complianceStore: ComplianceStore;
    replyTo?: string;
};
declare function makeSelfManagedAdapter(creds: SelfManagedCreds): MarketingAdapter & {
    createSegment: SelfManagedStore['createSegment'];
    listSegments: SelfManagedStore['listSegments'];
    scheduleCampaign: SelfManagedStore['scheduleCampaign'];
    recordOpen: SelfManagedStore['recordOpen'];
    recordClick: SelfManagedStore['recordClick'];
};

export { type Segment, type SegmentFilter, type SelfManagedCreds, type SelfManagedMail, type SelfManagedStore, makeSelfManagedAdapter };
