import { site } from './site';

/**
 * Generate a WhatsApp deep link with a pre-filled message.
 * Per Meta 2025 guidance, all flows must be inbound-first
 * (customer initiates the conversation).
 */
export function waLink(message: string): string {
    const text = encodeURIComponent(message);
    return `https://wa.me/${site.whatsapp}?text=${text}`;
}

export function waProductQuote(productName: string, qty?: number): string {
    const q = qty && qty > 1 ? ` (qty ${qty})` : '';
    return waLink(`Hi ${site.brand}, I need a quote for ${productName}${q}.`);
}

export function waGeneralInquiry(): string {
    return waLink(`Hi ${site.brand}, I'd like to inquire about your products.`);
}

export function waBulkInquiry(items: { name: string; qty?: number }[]): string {
    const lines = items.map((it) => `- ${it.name}${it.qty ? ` × ${it.qty}` : ''}`).join('\n');
    return waLink(`Hi ${site.brand}, please quote for the following:\n${lines}`);
}
