/**
 * src/integrations/zatca/invoice.ts
 * ZATCA invoice orchestrator — Phase 1.
 *
 * What it does:
 *   1. Validates input (Saudi VAT format, items, currency)
 *   2. Loads tenant seller snapshot (name, VAT #, CR)
 *   3. Computes subtotal / VAT / total at standard 15% (overridable per item)
 *   4. Renders UBL 2.1 invoice XML
 *   5. Builds Phase-1 TLV QR payload + PNG (returned as base64 data URL)
 *   6. Persists in zatca_invoices with status='pending_approval'
 *   7. Creates an approval_request (24h expiry — merchant may be in a meeting)
 *   8. Returns invoice ID + QR + approval ID for the agent to relay
 *
 * What it does NOT do (yet):
 *   - Cryptographic signing / digital stamp (Phase 2)
 *   - Calling ZATCA Fatoora compliance/clearance API (Phase 2)
 *   - Generating a PDF (intentional — WhatsApp prefers image messages, and
 *     the QR PNG is enough; PDF is a follow-up if a customer demands it).
 */
import { z } from 'zod';
import { type UblInvoiceTotals } from './ubl.js';
declare const issueInputSchema: z.ZodObject<{
    customerId: z.ZodString;
    buyerName: z.ZodString;
    buyerVatNumber: z.ZodOptional<z.ZodString>;
    invoiceType: z.ZodDefault<z.ZodEnum<{
        standard: "standard";
        simplified: "simplified";
    }>>;
    currency: z.ZodDefault<z.ZodLiteral<"SAR">>;
    items: z.ZodArray<z.ZodObject<{
        description: z.ZodString;
        quantity: z.ZodNumber;
        unitPrice: z.ZodNumber;
        vatRate: z.ZodDefault<z.ZodNumber>;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type IssueInvoiceInput = z.infer<typeof issueInputSchema>;
export type IssueInvoiceResult = {
    invoiceId: string;
    invoiceNumber: string;
    approvalRequestId: string;
    qrDataUrl: string;
    qrPayloadBase64: string;
    totals: UblInvoiceTotals;
    status: 'pending_approval';
    expiresAt: string;
};
export declare function issueZatcaInvoice(tenantId: string, rawInput: unknown): Promise<IssueInvoiceResult>;
/**
 * Called from approval/manager.ts when a merchant approves a queued ZATCA
 * invoice. Decodes the stored TLV QR back to PNG, uploads it to the tenant's
 * Supabase Storage with a 10-min signed URL, and sends the customer:
 *   1. The QR PNG with a caption summarizing the invoice
 *   2. A separate text fallback if image delivery fails
 * Marks status='issued' on success.
 */
export declare function deliverApprovedZatcaInvoice(tenantId: string, approvalRequestId: string): Promise<void>;
export {};
//# sourceMappingURL=invoice.d.ts.map