import { Product } from '@salla.sa/twilight/types/common';
import { ProductOption } from '../salla-order-details/interfaces';
import { Option as ProductOptionDefinition } from '../salla-product-options/interfaces';
export type OrderEditSelectedOptions = Record<string, FormDataEntryValue>;
export type OrderEditProductOption = ProductOptionDefinition;
export type OrderEditProductOptionsElement = HTMLSallaProductOptionsElement & {
    getOptionsData?: () => Promise<OrderEditProductOption[]>;
    getSelectedOptionsData?: () => Promise<OrderEditSelectedOptions>;
    reportValidity?: () => Promise<boolean>;
    validateAndScroll?: () => Promise<boolean>;
};
export interface MoneyObject {
    amount: number;
    currency: string;
}
export interface OrderEditData {
    id: number | string;
    reference_id?: number;
    status?: {
        id: number;
        name: string;
        color: string;
        slug?: string;
    };
    items: OrderEditItem[];
    total?: MoneyObject;
    get_total?: MoneyObject;
    sub_total?: MoneyObject;
    shipping?: {
        id?: number;
        name?: string;
        cost?: MoneyObject | null;
    };
    coupon?: string;
    discount?: number;
    total_discount?: number;
    tax?: {
        percent?: string;
        amount?: MoneyObject;
    };
    options?: any[];
    options_total?: number;
    customer_editing?: {
        enabled: boolean;
        ends_at?: string;
        edit_url?: string;
    };
    customer_editing_session?: {
        ends_at?: string;
    };
}
export interface OrderEditItemProduct extends Partial<Product> {
    weight_label?: string;
    options?: OrderEditProductOption[];
    max_quantity_per_order?: number;
}
export interface OrderEditItem {
    id: number | string;
    name?: string;
    description?: string;
    quantity: number;
    product?: OrderEditItemProduct;
    options?: ProductOption[];
    selectedOptions?: OrderEditSelectedOptions;
    isNew?: boolean;
}
export interface OrderEditPayloadItem {
    id: number | string;
    quantity: number;
    options: OrderEditSelectedOptions;
}
export interface OrderEditPayloadAddItem {
    product_id: number | string;
    quantity: number;
    options: OrderEditSelectedOptions;
}
export interface OrderEditPayload {
    items: {
        update: OrderEditPayloadItem[];
        remove: (number | string)[];
        add: OrderEditPayloadAddItem[];
    };
}
export interface EditOrderResponseItem {
    id: number | string;
    name: string;
    quantity: number;
    options: string[];
    price: MoneyObject;
}
export interface EditOrderResponseTotals {
    updated_products_total: MoneyObject;
    subtotal: MoneyObject;
    discount: MoneyObject;
    tax: {
        percent: string;
        amount: MoneyObject;
    };
    total: MoneyObject;
    remaining_amount?: MoneyObject;
    refund_amount?: MoneyObject;
}
export interface EditOrderResponsePayment {
    required: boolean;
    payment_url?: string;
}
export interface EditOrderResponse {
    items: EditOrderResponseItem[];
    totals: EditOrderResponseTotals;
    payment: EditOrderResponsePayment;
}
