import { Merchant } from './auth'; export interface OrderRequest { addressId: string; paymentMethodId: string; paymentMethod: string; orderType: string; idempotencyKey: string; } export interface PlaceOrderResponse { success: boolean; message: string; orders: Order[]; } export interface Order { id: string; orderNumber: string; customerId: string; merchantId: string; couponCode: string | null; appliedPromotionId: string | null; status: OrderStatus; orderType: OrderType; paymentMethodId: string; paymentMethod: PaymentMethod; currency: string; subtotal: string; deliveryFee: string; platformFee: string; serviceFee: string; taxAmount: string; discountAmount: string; totalAmount: string; pickupAddress: PickupAddress; dropAddress: DropAddress; metadata: OrderMetadata; version: number; createdAt: string; updatedAt: string; deletedAt: string | null; orderItems?: OrderItem[]; payments?: Payment[]; delivery?: Delivery; merchant?: Merchant; customer?: OrderCustomer; tracking?: TrackingEntry[]; } // Add these new interfaces export interface OrderCustomerUser { name: string; phone: string; } export interface OrderCustomer { id: string; userId: string; customerCode: string; createdAt: string; deletedAt: string | null; user: OrderCustomerUser; } export interface TrackingEntry { status: OrderStatus; time: string; } export interface PickupAddress { city: string; label: string | null; phone: string; state: string; landmark: string; postalCode: string; houseNumber: string; addressLine1: string; } export interface DropAddress { city: string; label: string; phone: string; state: string; landmark: string; latitude: number; longitude: number; postalCode: string; houseNumber: string; addressLine1: string; } export interface OrderMetadata { idempotencyKey: string; trackingHistory: TrackingHistory; } export interface TrackingHistory { PLACED: string; CONFIRMED: string; // Future statuses can be added here: // PREPARING?: string; // OUT_FOR_DELIVERY?: string; // DELIVERED?: string; // CANCELLED?: string; } export interface OrderItem { id: string; orderId: string; productId: string; itemType: 'PRODUCT' | 'SERVICE'; name: string; quantity: string; unitPrice: string; totalAmount: string; attributes: Record; } export interface Payment { id: string; orderId: string; paymentReference: string; paymentMethodId: string; method: PaymentMethod; provider: PaymentMethod; providerPaymentId: string | null; status: PaymentStatus; amount: string; currency: string; idempotencyKey: string; metadata: Record; createdAt: string; updatedAt: string; } export interface Delivery { id: string; orderId: string; deliveryPartnerId: string | null; deliveryNumber: string; status: DeliveryStatus; estimatedDistanceKm: number | null; actualDistanceKm: number | null; proofOfPickupKey: string | null; proofOfDeliveryKey: string | null; pickedUpAt: string | null; deliveredAt: string | null; } // export interface Merchant { // name: string; // imageUrl: string | null; // } export type PaymentStatus = | 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'REFUNDED'; export type DeliveryStatus = | 'PENDING_ASSIGNMENT' | 'ASSIGNED' | 'PICKED_UP' | 'IN_TRANSIT' | 'DELIVERED' | 'CANCELLED'; export type OrderStatus = | 'PENDING' | 'CONFIRMED' | 'PREPARING' | 'READY_FOR_PICKUP' | 'OUT_FOR_DELIVERY' | 'DELIVERED' | 'CANCELLED'; export type OrderType = 'DELIVERY' | 'PICKUP'; export type PaymentMethod = 'CARD' | 'CASH' | 'UPI' | 'WALLET' | 'NET_BANKING';