export type OrderStatus =
  | "pending"
  | "confirmed"
  | "processing"
  | "shipped"
  | "delivered"
  | "cancelled"
  | "refunded"
  | "return"
  | "completed";

export type PaymentStatus = "pending" | "paid" | "failed" | "refunded";

export interface OrderLineItem {
  _id: string;
  variantId: string;
  productName: string;
  variantName: string;
  sku: string;
  quantity: number;
  unitPrice: number;
  totalPrice: number;
  imageUrl?: string;
}

export interface OrderSummary {
  _id: string;
  _creationTime: number;
  orderNumber: string;
  status: OrderStatus;
  paymentStatus: PaymentStatus;
  total: number;
  currency: string;
  createdAt: number;
  updatedAt: number;
  shippingMethod: string;
  carrier: string;
  trackingNumber?: string;
  trackingUrl?: string;
  estimatedDelivery?: number;
  shippingAddressSnapshot: {
    fullName: string;
    firstName: string;
    lastName: string;
    addressLine1: string;
    additionalInformation?: string;
    city: string;
    postalCode: string;
    country: string;
    phone?: string;
  };
}

export interface OrderDetail extends OrderSummary {
  items: OrderLineItem[];
  subtotal: number;
  tax: number;
  shipping: number;
  discount: number;
  email: string;
  billingAddressSnapshot: {
    firstName: string;
    lastName: string;
    addressLine1: string;
    additionalInformation?: string;
    city: string;
    postalCode: string;
    country: string;
  };
  stripePaymentIntentId?: string;
  shippoShipmentId: string;
  paidAt?: number;
  shippedAt?: number;
  actualDelivery?: number;
  notes?: string;
  returnRequestedAt?: number;
  returnReceivedAt?: number;
}

export interface OrderCancellationResult {
  success: boolean;
  message: string;
}
