export interface DateRange {
  from?: string; // ISO 8601
  to?: string; // ISO 8601
}

export interface ShipmentsByMethodFilters {
  shipping_method_code?: string;
  shipping_method_id?: number;
  date_range?: DateRange;
  customer_name?: string;
  user_id?: number;
  status?: 'pending' | 'confirmed' | 'processing' | 'shipped' | 'delivered' | 'cancelled';
  payment_status?: 'pending' | 'paid' | 'failed' | 'refunded' | 'cancelled';
  min_shipping_cost?: number;
  max_shipping_cost?: number;
  group_by_method?: boolean;
  limit: number;
  offset: number;
}

export interface Shipment {
  order_id: number;
  order_number: string;
  user_id: number;
  customer_name: string;
  customer_phone: string;
  shipping_method_id: number;
  shipping_method: string;
  shipping_method_code: string;
  shipping_cost: number; // ریال
  delivery_date?: string; // YYYY-MM-DD
  delivery_from_hour?: number; // 0-23
  delivery_to_hour?: number; // 0-23
  status: string;
  payment_status: string;
  total_weight: number; // گرم
  order_amount: number; // ریال
  created_at: string; // ISO 8601
  shipped_at?: string; // ISO 8601
  delivered_at?: string; // ISO 8601
}

export interface MethodSummary {
  shipping_method_id: number;
  shipping_method: string;
  shipping_method_code: string;
  shipment_count: number;
  total_revenue: number; // ریال
  total_shipping_cost: number; // ریال
  average_weight: number; // گرم
  delivered_count: number;
  cancelled_count: number;
}

export interface ShipmentsSummary {
  total_shipments: number;
  total_shipping_cost: number; // ریال
  total_order_amount: number; // ریال
  total_weight: number; // گرم
  pending_shipments: number;
  shipped_count: number;
  delivered_count: number;
  cancelled_count: number;
  average_shipping_cost: number; // ریال
  average_delivery_time?: number; // ساعت
}

export interface ShipmentsByMethodResponse {
  shipments: Shipment[];
  summary: ShipmentsSummary;
  method_summaries?: MethodSummary[];
  total: number;
  has_more: boolean;
  limit: number;
  offset: number;
}

