import type { PoWorkbenchListRow } from "@/components/PoWorkbench/types";

/**
 * File: grid layout tokens + `MOCK_WORKBENCH_SEARCH_RESULTS` for local dev (shell uses `/po/list` instead).
 */
/**
 * One of four panes in the PO Workbench CSS grid (row-major).
 *
 * - `searchCriteria` — Search filters (top-left).
 * - `detailsHeader` — Detail header or summary (top-right).
 * - `searchResults` — Search result list (bottom-left).
 * - `details` — Primary detail content (bottom-right).
 */
export type WorkbenchGridRegionId =
  | "searchCriteria"
  | "searchResults"
  | "detailsHeader"
  | "details";

/**
 * CSS `grid-template-columns` for the workbench (md+ only; below `md` the shell uses a compact column layout).
 * Proportions: 35% search / 65% detail (`minmax(0, …)` avoids track overflow).
 */
export const WORKBENCH_GRID_TEMPLATE_COLUMNS = "minmax(0, 35%) minmax(0, 65%)";

/**
 * CSS `grid-template-rows` for the workbench: top strip vs. main content row.
 *
 * @remarks Top row uses `auto` so the criteria bar and detail header can grow with content
 * (e.g. stacked dates) without clipping. The second row absorbs remaining height (`1fr`).
 */
export const WORKBENCH_GRID_TEMPLATE_ROWS = "auto minmax(0, 1fr)";

/**
 * Order of grid cells for `display: grid` auto-placement (row-major).
 *
 * Visual layout:
 * ```
 * searchCriteria | detailsHeader
 * searchResults  | details
 * ```
 */
export const WORKBENCH_GRID_REGION_ORDER: readonly WorkbenchGridRegionId[] = [
  "searchCriteria",
  "detailsHeader",
  "searchResults",
  "details",
];

/** Mock PO numbers are fixed 16 characters for UI width testing. */
export const MOCK_WORKBENCH_SEARCH_RESULTS: readonly PoWorkbenchListRow[] = [
  {
    id: "1",
    poNumber: "PO20250401000001",
    supplierName: "Acme Components Ltd.",
    orderDate: "2025-04-01",
    estimatedArrivalDate: "2025-04-18",
    escalated: true,
    status: "receiving",
  },
  {
    id: "2",
    poNumber: "PO20250401000002",
    supplierName: "Northwind Trading Co.",
    orderDate: "2025-04-01",
    estimatedArrivalDate: "2025-04-22",
    escalated: false,
    status: "pending",
  },
  {
    id: "3",
    poNumber: "PO20250401000003",
    supplierName: "Contoso Materials HK Branch",
    orderDate: "2025-04-02",
    estimatedArrivalDate: "2025-04-25",
    escalated: true,
    status: "completed",
  },
  {
    id: "4",
    poNumber: "PO20241201000004",
    supplierName: "Fabrikam Industries International",
    orderDate: "2024-12-01",
    estimatedArrivalDate: "2025-01-15",
    escalated: true,
    status: "completed",
  },
  {
    id: "5",
    poNumber: "PO20250402000005",
    supplierName: "Wide World Importers (Asia) Ltd.",
    orderDate: "2025-04-02",
    estimatedArrivalDate: "2025-04-20",
    escalated: false,
    status: "pending",
  },
  {
    id: "6",
    poNumber: "PO20250402000006",
    supplierName: "Adventure Works Manufacturing",
    orderDate: "2025-04-02",
    estimatedArrivalDate: "2025-04-28",
    escalated: true,
    status: "receiving",
  },
  {
    id: "7",
    poNumber: "PO20250403000007",
    supplierName: "Tailspin Toys Logistics Limited",
    orderDate: "2025-04-03",
    estimatedArrivalDate: "2025-05-02",
    escalated: false,
    status: "completed",
  },
  {
    id: "8",
    poNumber: "PO20250403000008",
    supplierName:
      "Very Very Long Supplier Name (Hong Kong) Co., Ltd. — International Procurement & Strategic Sourcing Division",
    orderDate: "2025-04-03",
    estimatedArrivalDate: "2025-05-06",
    escalated: true,
    status: "pending",
  },
  {
    id: "9",
    poNumber: "PO20250404000009",
    supplierName:
      "Mega Industrial Parts & Components Trading (Asia Pacific) — Shenzhen / Dongguan / Guangzhou Regional Office",
    orderDate: "2025-04-04",
    estimatedArrivalDate: "2025-04-30",
    escalated: false,
    status: "receiving",
  },
  {
    id: "10",
    poNumber: "PO20250405000010",
    supplierName:
      "Example Supplier With An Extremely Long Legal Entity Name That Should Force Wrapping Across Multiple Lines (Invoice Dept.)",
    orderDate: "2025-04-05",
    estimatedArrivalDate: "2025-05-12",
    escalated: true,
    status: "completed",
  },
  {
    id: "11",
    poNumber: "PO20250406000011",
    supplierName:
      "Global Manufacturing & Logistics Services Limited (c/o Warehouse 3, Block B, 1234 Some Very Long Industrial Estate Road, Kwai Chung, NT)",
    orderDate: "2025-04-06",
    estimatedArrivalDate: "2025-05-15",
    escalated: false,
    status: "receiving",
  },
];
