/**
 * أنواع واتساب — WhatsApp Cloud API v21.0 Types
 * يغطي جميع أنواع الرسائل الواردة والصادرة وتحديثات الحالة
 */
/** Root webhook payload from Meta */
export interface WhatsAppWebhookPayload {
    object: 'whatsapp_business_account';
    entry: WhatsAppEntry[];
}
export interface WhatsAppEntry {
    id: string;
    changes: WhatsAppChange[];
}
export interface WhatsAppChange {
    value: WhatsAppChangeValue;
    field: 'messages';
}
export interface WhatsAppChangeValue {
    messaging_product: 'whatsapp';
    metadata: WhatsAppMetadata;
    contacts?: WhatsAppContact[];
    messages?: WhatsAppIncomingMessage[];
    statuses?: WhatsAppStatusUpdate[];
    errors?: WhatsAppError[];
}
export interface WhatsAppMetadata {
    display_phone_number: string;
    phone_number_id: string;
}
export interface WhatsAppContact {
    profile: {
        name: string;
    };
    wa_id: string;
}
export interface WhatsAppIncomingMessage {
    from: string;
    id: string;
    timestamp: string;
    type: WhatsAppMessageType;
    text?: WhatsAppTextContent;
    image?: WhatsAppMediaContent;
    audio?: WhatsAppMediaContent;
    video?: WhatsAppMediaContent;
    document?: WhatsAppDocumentContent;
    location?: WhatsAppLocationContent;
    contacts?: WhatsAppContactContent[];
    interactive?: WhatsAppInteractiveContent;
    button?: WhatsAppButtonReply;
    sticker?: WhatsAppMediaContent;
    reaction?: WhatsAppReactionContent;
    context?: WhatsAppMessageContext;
    referral?: WhatsAppReferral;
    errors?: WhatsAppError[];
}
export type WhatsAppMessageType = 'text' | 'image' | 'audio' | 'video' | 'document' | 'location' | 'contacts' | 'interactive' | 'button' | 'sticker' | 'reaction' | 'order' | 'system' | 'unknown';
export interface WhatsAppTextContent {
    body: string;
}
export interface WhatsAppMediaContent {
    id: string;
    mime_type: string;
    sha256?: string;
    caption?: string;
}
export interface WhatsAppDocumentContent extends WhatsAppMediaContent {
    filename?: string;
}
export interface WhatsAppLocationContent {
    latitude: number;
    longitude: number;
    name?: string;
    address?: string;
}
export interface WhatsAppContactContent {
    name: {
        formatted_name: string;
        first_name?: string;
        last_name?: string;
    };
    phones?: Array<{
        phone: string;
        type?: string;
        wa_id?: string;
    }>;
    emails?: Array<{
        email: string;
        type?: string;
    }>;
}
export interface WhatsAppInteractiveContent {
    type: 'button_reply' | 'list_reply';
    button_reply?: {
        id: string;
        title: string;
    };
    list_reply?: {
        id: string;
        title: string;
        description?: string;
    };
}
export interface WhatsAppButtonReply {
    text: string;
    payload: string;
}
export interface WhatsAppReactionContent {
    message_id: string;
    emoji: string;
}
export interface WhatsAppMessageContext {
    from?: string;
    id?: string;
    referred_product?: {
        catalog_id: string;
        product_retailer_id: string;
    };
}
export interface WhatsAppReferral {
    source_url: string;
    source_type: string;
    source_id: string;
    headline?: string;
    body?: string;
}
export interface WhatsAppStatusUpdate {
    id: string;
    status: WhatsAppMessageStatus;
    timestamp: string;
    recipient_id: string;
    conversation?: {
        id: string;
        origin: {
            type: 'business_initiated' | 'user_initiated' | 'referral_conversion';
        };
        expiration_timestamp?: string;
    };
    pricing?: {
        billable: boolean;
        pricing_model: string;
        category: string;
    };
    errors?: WhatsAppError[];
}
export type WhatsAppMessageStatus = 'sent' | 'delivered' | 'read' | 'failed';
export interface WhatsAppError {
    code: number;
    title: string;
    message?: string;
    error_data?: {
        details: string;
    };
    href?: string;
}
export interface WhatsAppOutgoingMessage {
    messaging_product: 'whatsapp';
    recipient_type: 'individual';
    to: string;
    type: WhatsAppOutgoingMessageType;
    text?: {
        preview_url?: boolean;
        body: string;
    };
    image?: {
        link: string;
        caption?: string;
    };
    audio?: {
        link: string;
    };
    video?: {
        link: string;
        caption?: string;
    };
    document?: {
        link: string;
        filename: string;
        caption?: string;
    };
    template?: WhatsAppTemplateMessage;
    interactive?: WhatsAppInteractiveMessage;
    reaction?: {
        message_id: string;
        emoji: string;
    };
}
export type WhatsAppOutgoingMessageType = 'text' | 'image' | 'audio' | 'video' | 'document' | 'template' | 'interactive' | 'reaction';
export interface WhatsAppTemplateMessage {
    name: string;
    language: {
        code: string;
    };
    components?: WhatsAppTemplateComponent[];
}
export interface WhatsAppTemplateComponent {
    type: 'header' | 'body' | 'button';
    sub_type?: 'quick_reply' | 'url';
    index?: number;
    parameters: WhatsAppTemplateParameter[];
}
export interface WhatsAppTemplateParameter {
    type: 'text' | 'currency' | 'date_time' | 'image' | 'document' | 'video';
    text?: string;
    currency?: {
        fallback_value: string;
        code: string;
        amount_1000: number;
    };
    date_time?: {
        fallback_value: string;
    };
    image?: {
        link: string;
    };
    document?: {
        link: string;
        filename?: string;
    };
    video?: {
        link: string;
    };
}
export interface WhatsAppInteractiveMessage {
    type: 'button' | 'list' | 'product' | 'product_list';
    header?: {
        type: 'text' | 'image' | 'video' | 'document';
        text?: string;
        image?: {
            link: string;
        };
        video?: {
            link: string;
        };
        document?: {
            link: string;
        };
    };
    body: {
        text: string;
    };
    footer?: {
        text: string;
    };
    action: WhatsAppInteractiveAction;
}
export interface WhatsAppInteractiveAction {
    buttons?: Array<{
        type: 'reply';
        reply: {
            id: string;
            title: string;
        };
    }>;
    button?: string;
    sections?: Array<{
        title?: string;
        rows: Array<{
            id: string;
            title: string;
            description?: string;
        }>;
    }>;
}
export interface WhatsAppAPIResponse {
    messaging_product: 'whatsapp';
    contacts?: Array<{
        input: string;
        wa_id: string;
    }>;
    messages: Array<{
        id: string;
        message_status?: string;
    }>;
}
export interface WhatsAppMediaURLResponse {
    url: string;
    mime_type: string;
    sha256: string;
    file_size: number;
    id: string;
    messaging_product: 'whatsapp';
}
/** نتيجة معالجة الرسالة الواردة */
export interface ParsedIncomingMessage {
    messageId: string;
    from: string;
    timestamp: Date;
    type: WhatsAppMessageType;
    text?: string;
    mediaId?: string;
    mimeType?: string;
    caption?: string;
    filename?: string;
    location?: WhatsAppLocationContent;
    contacts?: WhatsAppContactContent[];
    interactiveReply?: {
        type: 'button_reply' | 'list_reply';
        id: string;
        title: string;
        description?: string;
    };
    buttonReply?: {
        text: string;
        payload: string;
    };
    profileName?: string;
    contextMessageId?: string;
}
/** نتيجة تحميل الوسائط */
export interface DownloadedMedia {
    buffer: Buffer;
    mimeType: string;
    filePath?: string;
}
//# sourceMappingURL=types.d.ts.map