import { invoices, type Invoice } from "@/pages/billing/invoices.mock";
import { customers, type Customer } from "@/pages/customers/customers.mock";

/**
 * Mock "logged-in customer". When auth integrates, replace this with the value
 * pulled from `@edr/iamui-common` / the JWT context.
 */
const CURRENT_CUSTOMER_ID = 1;

export function getCurrentCustomer(): Customer {
  return (
    customers.find((c) => c.id === CURRENT_CUSTOMER_ID) ??
    (customers[0] as Customer)
  );
}

export function getMyInvoices(): Invoice[] {
  const me = getCurrentCustomer();
  return invoices.filter((inv) => inv.customerId === me.id);
}
