/**
 * 把 `/order/sales/{id}` 响应（OrderData）解析为 ISalesDetail。
 *
 * - 纯函数：不依赖任何运行时模块/插件，便于单测与 view-model 适配
 * - products 保留 tempOrder / 后端详情原字段，仅做浅拷贝，避免丢失 product_sku 等协议字段
 * - bookings 平铺保留服务端原顺序，同时输出 byProductUid 反查表与 rootBooking
 * - header 收敛"非数组顶层字段"，便于 ticketBooking view-model 直接消费
 *
 * 设计原则参考 `.cursor/rules/data-field-semantics.mdc`：
 * - 字段命名以《统一 Sales 数据协议》为准（OrderData 类型）
 * - root booking 以 `parent_id === 0` 判定，沿用 ticketBooking 现有约定
 *   （`packages/private-materials/src/components/ticketBooking/index.tsx`：
 *    `booking.parent_id === 0 ? 'list' : 'detail'`）
 * - 不在此处发明等价关系；UI 侧（ticketBooking）若需要别的字段，由 view-model 适配层做转换
 */
import type { BaseSalesOrderProduct } from '../types';
export interface ISalesDetailHeader {
    order_id: number | string | null;
    order_number?: string;
    shop_order_number?: string;
    shop_full_order_number?: string;
    type?: string;
    business_code?: string;
    platform?: string;
    sales_channel?: string;
    order_sales_channel?: string;
    status?: string;
    payment_status?: string;
    shipping_status?: string;
    customer_id?: number | string | null;
    customer_name?: string;
    country_calling_code?: string;
    phone?: string;
    email?: string;
    is_price_include_tax?: 0 | 1;
    tax_title?: string;
    tax_country_code?: string;
    currency_code?: string;
    currency_symbol?: string;
    currency_format?: string;
    is_deposit?: 0 | 1;
    deposit_amount?: string;
    shop_discount?: string;
    surcharge_fee?: string;
    note?: string;
    schedule_date?: string;
    created_at?: string;
    updated_at?: string | number;
    metadata?: Record<string, any> | null;
    total_amount?: string | number;
    [key: string]: any;
}
export interface ISalesDetailCustomer {
    id: number | string | null;
    name: string;
    phone?: string;
    email?: string;
    country_calling_code?: string;
    [key: string]: any;
}
export interface ISalesBooking {
    schedule_event_id?: number | null;
    booking_id?: string;
    appointment_status?: string;
    status?: string;
    start_date?: string;
    start_time?: string;
    end_date?: string;
    end_time?: string;
    duration?: number;
    sub_type?: string;
    number?: number;
    resources?: any[];
    product?: any;
    relation_products?: any[];
    relation_type?: string;
    relation_id?: number;
    parent_id?: number | null;
    item_type?: string;
    product_uid?: string;
    metadata?: Record<string, any> | null;
    [key: string]: any;
}
export interface ISalesPayment {
    order_payment_id?: number | null;
    custom_payment_id?: number;
    code?: string;
    name?: string;
    type?: string;
    voucher_id?: number | null;
    amount: string;
    origin_amount?: string;
    rounding_amount?: string;
    status?: string;
    payment_time?: string | null;
    service_charge?: Record<string, any> | null;
    metadata?: Record<string, any> | null;
    [key: string]: any;
}
export interface ISalesSurcharge {
    order_surcharge_id?: number | null;
    surcharge_id?: number;
    type?: string;
    name?: Record<string, string>;
    description?: Record<string, string>;
    percentage?: string | null;
    fixed?: string | null;
    amount?: string;
    [key: string]: any;
}
export interface ISalesDetail {
    /** 顶部订单字段集合（不含 products / bookings / payments / surcharges 等大数组） */
    header: ISalesDetailHeader;
    /** 商品行快照（保留 tempOrder / 后端详情原字段） */
    products: BaseSalesOrderProduct[];
    /** 全部 bookings，按服务端原始顺序输出（含 root + child） */
    bookings: ISalesBooking[];
    /** root booking（parent_id === 0），多个时取首个，无则为 null */
    rootBooking: ISalesBooking | null;
    /** product_uid → bookings 反查表，便于商品行 ↔ booking 映射 */
    bookingsByProductUid: Record<string, ISalesBooking[]>;
    /** 支付列表 */
    payments: ISalesPayment[];
    /** 附加费 */
    surcharges: ISalesSurcharge[];
    /** 订单级折扣列表 */
    discount_list: any[];
    /** 客户信息（按 header 抽取，必要时透传 raw.customer） */
    customer: ISalesDetailCustomer | null;
    /** 服务端 summary（仅输出） */
    summary: Record<string, any>;
    /** 原始响应快照，方便 UI 兜底使用 */
    raw: Record<string, any>;
}
/**
 * 将 `/order/sales/{id}` 响应解析为 ISalesDetail。
 *
 * 注意：
 * - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`，自动识别。
 * - products 保留原字段；字段补齐由 OrderModule hydrate 负责。
 * - 不做远程请求；不修改入参；返回新对象。
 */
export declare function parseSalesResponse(input: Record<string, any> | null | undefined): ISalesDetail;
