// ─── Sales Report Summary ───────────────────────────────────────

export interface SalesReportSummary {
  quotations_count: number;
  quotations_value: string;
  orders_count: number;
  orders_value: string;
  invoices_count: number;
  invoices_value: string;
  returns_count: number;
  returns_value: string;
  net_sales: string;
  amount_collected: string;
  amount_outstanding: string;
  average_invoice_value: string;
}

// ─── Sales Report by Product ────────────────────────────────────

export interface SalesReportByProduct {
  product_id: number;
  product_name: string;
  product_code: string;
  category_id: number | null;
  category_name: string | null;
  quantity_sold: string;
  total_sales: string;
  total_cost: string;
  gross_profit: string;
  profit_margin: string;
  return_quantity: string;
  net_quantity: string;
  net_sales: string;
}

// ─── Sales Report by Customer ───────────────────────────────────

export interface SalesReportByCustomer {
  customer_id: number;
  customer_name: string;
  customer_code: string;
  invoices_count: number;
  total_sales: string;
  total_returns: string;
  net_sales: string;
  amount_paid: string;
  balance_due: string;
  average_invoice: string;
  last_invoice_date: string | null;
}

// ─── Sales Report Trends ────────────────────────────────────────

export interface SalesReportTrends {
  period: string;
  period_label: string;
  invoices_count: number;
  total_sales: string;
  total_returns: string;
  net_sales: string;
  total_cost: string;
  gross_profit: string;
  profit_margin: string;
}

// ─── Overdue Invoice ────────────────────────────────────────────

export interface OverdueInvoice {
  id: number;
  invoice_number: string;
  date: string;
  due_date: string;
  customer_id: number;
  customer_name: string;
  customer_code: string;
  total: string;
  amount_paid: string;
  balance_due: string;
  days_overdue: number;
}

// ─── Aging Buckets ──────────────────────────────────────────────

export interface AgingBuckets {
  customer_id: number;
  customer_name: string;
  customer_code: string;
  current: string;
  days_1_30: string;
  days_31_60: string;
  days_61_90: string;
  days_over_90: string;
  total: string;
}

// ─── Conversion Funnel ──────────────────────────────────────────

export interface ConversionFunnel {
  total_quotations: number;
  converted_to_orders: number;
  quotation_to_order_rate: string;
  total_orders: number;
  converted_to_invoices: number;
  order_to_invoice_rate: string;
  total_invoices: number;
  fully_paid_invoices: number;
  invoice_to_payment_rate: string;
  average_days_to_convert: number;
  average_days_to_pay: number;
}
