/* ============================================================
   Carzello — admin console data
   ============================================================ */

/* Real operator accounts only — the team adds more via Admin → Staff. */
const SEED_STAFF = [
  { id: "op1", name: "Obaidullah Didar", email: "obaidullah.didar3@gmail.com", role: "Owner", status: "active", lastActive: "—" },
  { id: "op2", name: "Sayarah Support", email: "support@sayarah.io", role: "Ops manager", status: "active", lastActive: "—" },
];

const STAFF_ROLES = ["Owner", "Ops manager", "Inspector", "Support", "Logistics", "Finance"];

/* ---- Dealers (buyer accounts the admin onboards) ---- */
const DEALER_COUNTRIES = ["UAE", "Saudi Arabia", "Oman", "Qatar", "Kuwait", "Uzbekistan", "Kazakhstan", "Afghanistan"];
const SEED_DEALERS = []; // real dealers are onboarded via Admin → Dealers

function blankDealer() {
  return { business: "", contact: "", email: "", phone: "", license: "", country: "UAE", creditLimit: 100000 };
}

/* ---- Consignors (dealers/fleets/companies whose cars Sayarah sells) ---- */
const SEED_CONSIGNORS = []; // real consignors are onboarded via Admin → Consignors (their email = portal login)
const CONSIGNOR_TYPES = ["Dealer", "Fleet", "Leasing", "Wholesaler", "Bank/Repo"];
function blankConsignor() {
  return { business: "", contact: "", email: "", phone: "", type: "Dealer", country: "USA", payout: "", status: "active", rating: 0 };
}

const SEED_CLAIMS = []; // real claims arrive from buyers via the arbitration flow

/* 14-day sales/GMV series for reports (most recent last) */
const REPORT_DAYS = ["May 23","May 24","May 25","May 26","May 27","May 28","May 29","May 30","May 31","Jun 1","Jun 2","Jun 3","Jun 4","Jun 5"];
const REPORT_GMV = [182, 210, 168, 240, 305, 288, 196, 142, 264, 318, 352, 298, 340, 386]; // $k
const REPORT_SOLD = [9, 11, 8, 12, 15, 14, 10, 7, 13, 16, 18, 15, 17, 19];
const REPORT_BY_MAKE = [
  { make: "Toyota", sold: 64, gmv: 1480 },
  { make: "Lexus", sold: 22, gmv: 980 },
  { make: "Ford", sold: 18, gmv: 560 },
  { make: "Nissan", sold: 16, gmv: 410 },
  { make: "Honda", sold: 14, gmv: 320 },
  { make: "Hyundai", sold: 11, gmv: 240 },
];

/* blank raw-lot template for "Add car" */
function blankLot() {
  return {
    id: "", year: "", make: "", model: "", trim: "", body: "SUV",
    vin: "", mileage: "", transmission: "Automatic", drivetrain: "AWD", fuel: "Gasoline",
    colorExt: "", colorInt: "", location: "", region: "", owned: true, seller: "Sayarah Auto", source: "SAYARAH",
    lane: "A", run: "", photos: 24,
    autograde: 3.5, grades: { exterior: 3.5, interior: 3.5, mechanical: 3.5, frame: 4.5, tires: 3.5 },
    title: "Clean", titleNote: "", saleType: "timed",
    startPrice: "", reserve: "", buyNow: "", increment: 250, marketValue: "",
    endsInS: 24 * 3600, heat: 0.5, competitors: 3,
    odometerCheck: "Actual", keys: 2,
    announcements: [{ t: "Frame", ok: true, text: "No frame damage." }],
    crNotes: { exterior: "", interior: "", mechanical: "", tires: "" },
    damages: [],
    obd: [{ code: "—", status: "pass", desc: "All modules — no faults", when: "clear" }],
    tags: [],
  };
}

const ADMIN_NAV = [
  { id: "dashboard", label: "Dashboard", path: "/admin", icon: "grid" },
  { id: "inventory", label: "Inventory", path: "/admin/inventory", icon: "car" },
  { id: "auctions", label: "Live auctions", path: "/admin/auctions", icon: "gavel" },
  { id: "orders", label: "Orders", path: "/admin/orders", icon: "truck" },
  { id: "offers", label: "Offers", path: "/admin/offers", icon: "offer" },
  { id: "freight", label: "Freight rates", path: "/admin/freight", icon: "trend" },
  { id: "arbitration", label: "Arbitration", path: "/admin/arbitration", icon: "shield" },
  { id: "dealers", label: "Dealers", path: "/admin/dealers", icon: "store" },
  { id: "consignors", label: "Consignors", path: "/admin/consignors", icon: "truck" },
  { id: "staff", label: "Staff", path: "/admin/staff", icon: "user" },
  { id: "reports", label: "Reports", path: "/admin/reports", icon: "doc" },
  { id: "settings", label: "Settings", path: "/admin/settings", icon: "cog" },
];

Object.assign(window, {
  SEED_STAFF, STAFF_ROLES, SEED_CLAIMS, SEED_DEALERS, DEALER_COUNTRIES, blankDealer,
  SEED_CONSIGNORS, CONSIGNOR_TYPES, blankConsignor,
  REPORT_DAYS, REPORT_GMV, REPORT_SOLD, REPORT_BY_MAKE,
  blankLot, ADMIN_NAV,
});
