import { ModuleRef } from '@nestjs/core';
import { PrismaService } from '../../prisma/prisma.service';
import { BusinessService } from '../business/business.service';
import { RoadrunnerClient, RoadrunnerConfig } from './roadrunner.client';
import { GeocodingService } from './geocoding.service';
export type QuoteOutcome = {
    ok: true;
    quoteId: string;
    fee: number;
    feeMinor: number;
    currency: string;
    distanceKm: number | null;
    expiresAt: string;
} | {
    ok: false;
    reason: 'not_configured' | 'out_of_area' | 'unserviceable' | 'invalid' | 'unavailable';
    message: string;
};
export declare class DeliveryService {
    private readonly prisma;
    private readonly businessService;
    private readonly client;
    private readonly geocoder;
    private readonly moduleRef;
    private readonly logger;
    constructor(prisma: PrismaService, businessService: BusinessService, client: RoadrunnerClient, geocoder: GeocodingService, moduleRef: ModuleRef);
    getConfig(businessId: string): Promise<RoadrunnerConfig | null>;
    isEnabled(businessId: string): Promise<boolean>;
    getStatus(businessId: string): Promise<{
        configured: boolean;
        connected: boolean;
        client?: undefined;
        scopes?: undefined;
        testMode?: undefined;
        environment?: undefined;
        pickupAddress?: undefined;
        maxRadiusKm?: undefined;
        error?: undefined;
    } | {
        configured: boolean;
        connected: boolean;
        client: string;
        scopes: string[];
        testMode: boolean;
        environment: string;
        pickupAddress: string | null;
        maxRadiusKm: number | null;
        error?: undefined;
    } | {
        configured: boolean;
        connected: boolean;
        error: any;
        environment: string;
        client?: undefined;
        scopes?: undefined;
        testMode?: undefined;
        pickupAddress?: undefined;
        maxRadiusKm?: undefined;
    }>;
    quote(businessId: string, input: {
        address: string;
        lat?: number | null;
        lng?: number | null;
        phone?: string;
        itemsValue?: number;
    }): Promise<QuoteOutcome>;
    createDraft(businessId: string, orderId: string, d: {
        address?: string;
        lat?: number | null;
        lng?: number | null;
        quoteId?: string;
        feeMinor?: number;
        currency?: string;
        distanceKm?: number | null;
    }): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        externalId: string | null;
        currency: string;
        businessId: string;
        orderId: string;
        provider: string;
        trackingUrl: string | null;
        quoteId: string | null;
        feeAmount: number | null;
        distanceMetres: number | null;
        dropoffAddress: string | null;
        dropoffLat: number | null;
        dropoffLng: number | null;
        courierName: string | null;
        courierPhone: string | null;
        eta: string | null;
        lastError: string | null;
        providerUpdatedAt: Date | null;
        bookedAt: Date | null;
        deliveredAt: Date | null;
        cancelledAt: Date | null;
    }>;
    bookForOrder(businessId: string, orderId: string): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        externalId: string | null;
        currency: string;
        businessId: string;
        orderId: string;
        provider: string;
        trackingUrl: string | null;
        quoteId: string | null;
        feeAmount: number | null;
        distanceMetres: number | null;
        dropoffAddress: string | null;
        dropoffLat: number | null;
        dropoffLng: number | null;
        courierName: string | null;
        courierPhone: string | null;
        eta: string | null;
        lastError: string | null;
        providerUpdatedAt: Date | null;
        bookedAt: Date | null;
        deliveredAt: Date | null;
        cancelledAt: Date | null;
    }>;
    refresh(businessId: string, orderId: string): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        externalId: string | null;
        currency: string;
        businessId: string;
        orderId: string;
        provider: string;
        trackingUrl: string | null;
        quoteId: string | null;
        feeAmount: number | null;
        distanceMetres: number | null;
        dropoffAddress: string | null;
        dropoffLat: number | null;
        dropoffLng: number | null;
        courierName: string | null;
        courierPhone: string | null;
        eta: string | null;
        lastError: string | null;
        providerUpdatedAt: Date | null;
        bookedAt: Date | null;
        deliveredAt: Date | null;
        cancelledAt: Date | null;
    } | null>;
    cancel(businessId: string, orderId: string, reason: string, note?: string): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        externalId: string | null;
        currency: string;
        businessId: string;
        orderId: string;
        provider: string;
        trackingUrl: string | null;
        quoteId: string | null;
        feeAmount: number | null;
        distanceMetres: number | null;
        dropoffAddress: string | null;
        dropoffLat: number | null;
        dropoffLng: number | null;
        courierName: string | null;
        courierPhone: string | null;
        eta: string | null;
        lastError: string | null;
        providerUpdatedAt: Date | null;
        bookedAt: Date | null;
        deliveredAt: Date | null;
        cancelledAt: Date | null;
    } | null>;
    getTimeline(businessId: string, orderId: string): Promise<{
        id: string;
        status: string | null;
        createdAt: Date;
        type: string;
        externalEventId: string | null;
        source: string | null;
        occurredAt: Date;
        dataJson: string | null;
        deliveryId: string;
    }[]>;
    listForBusiness(businessId: string): Promise<{
        delivery: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            externalId: string | null;
            currency: string;
            businessId: string;
            orderId: string;
            provider: string;
            trackingUrl: string | null;
            quoteId: string | null;
            feeAmount: number | null;
            distanceMetres: number | null;
            dropoffAddress: string | null;
            dropoffLat: number | null;
            dropoffLng: number | null;
            courierName: string | null;
            courierPhone: string | null;
            eta: string | null;
            lastError: string | null;
            providerUpdatedAt: Date | null;
            bookedAt: Date | null;
            deliveredAt: Date | null;
            cancelledAt: Date | null;
        } | null;
        id: string;
        status: string;
        createdAt: Date;
        orderNumber: string;
        customerName: string;
        customerPhone: string;
        totalAmount: number;
        currency: string;
        deliveryAddress: string | null;
        items: {
            id: string;
            productName: string;
            quantity: number;
            lineTotal: number;
        }[];
        paymentStatus: string;
        deliveryLat: number | null;
        deliveryLng: number | null;
        deliveryFee: number | null;
    }[]>;
    getPublicTracking(orderId: string): Promise<{
        business: {
            name: string;
        };
        delivery: {
            status: string;
            updatedAt: Date;
            trackingUrl: string | null;
            dropoffAddress: string | null;
            courierName: string | null;
            eta: string | null;
            bookedAt: Date | null;
            deliveredAt: Date | null;
            events: {
                status: string | null;
                type: string;
                occurredAt: Date;
            }[];
        } | null;
        status: string;
        createdAt: Date;
        orderNumber: string;
        customerName: string;
        deliveryAddress: string | null;
        deliveryMethod: string | null;
    }>;
    handleWebhook(rawBody: Buffer, headers: Record<string, any>): Promise<boolean>;
    private processWebhook;
    private applyRemoteState;
    private syncEvents;
    private recordEvent;
    private loadBooked;
    private createWithIdempotency;
    private markBookingFailed;
    private pickupFields;
    private toE164;
    private emitUpdate;
    private notifyCustomer;
}
