// Alba Cars — demo inventory data
// IMPORTANT: per design brief, the live build pulls inventory from a feed.
// These are illustrative records using real captured photos + clearly-labelled
// DEMO prices (AED). DO NOT treat as authoritative stock.

const V = (id, year, make, model, variant, body, mileage, ext, intC, engine, power, trans, drive, price, tags) => ({
  id, year, make, model, variant, body, mileage, ext, intC, engine, power, trans, drive, price,
  tags: tags || [],
  photo: `media/inv/${id}.webp`,
  stockId: `AC-${(Math.abs(hashCode(id)) % 9000 + 1000).toString()}`,
});

function hashCode(s){let h=0;for(let i=0;i<s.length;i++){h=((h<<5)-h)+s.charCodeAt(i);h|=0;}return h;}

const VEHICLES = [
  V('mercedes-g63', 2022, 'Mercedes-Benz', 'G 63 AMG', '4MATIC+', 'SUV', 28400, 'Obsidian Black', 'Red Nappa', '4.0L V8 Biturbo', '577 hp', 'AMG SPEEDSHIFT 9G', 'AWD', 1095000, ['Just Arrived','Featured']),
  V('ferrari-sf90', 2021, 'Ferrari', 'SF90 Stradale', 'Assetto Fiorano', 'Coupe', 6200, 'Rosso Corsa', 'Black Alcantara', '4.0L V8 Hybrid', '986 hp', '8-Speed DCT', 'AWD', null, ['POA','Showcase']),
  V('aston-martin-vantage', 2023, 'Aston Martin', 'Vantage', 'V8 Coupe', 'Coupe', 4800, 'Storm Purple', 'Obsidian Black', '4.0L V8 Twin-Turbo', '503 hp', '8-Speed ZF Auto', 'RWD', null, ['POA']),
  V('bmw-x7', 2023, 'BMW', 'X7', 'xDrive 40i M-Sport', 'SUV', 21500, 'Carbon Black', 'Cognac', '3.0L Inline-6', '375 hp', '8-Speed Steptronic', 'AWD', 412000, ['Featured']),
  V('bmw-x5', 2022, 'BMW', 'X5', 'xDrive 50i M-Sport', 'SUV', 34200, 'Alpine White', 'Tartufo', '4.4L V8', '456 hp', '8-Speed Steptronic', 'AWD', 339000),
  V('bmw-x4m', 2021, 'BMW', 'X4 M', 'Competition', 'SUV Coupe', 28900, 'Toronto Red', 'Black Merino', '3.0L Inline-6 Twin-Turbo', '503 hp', 'M Steptronic 8-Speed', 'AWD', 358000, ['Performance']),
  V('audi-q8', 2023, 'Audi', 'Q8', '55 TFSI S-Line', 'SUV Coupe', 18600, 'Mythos Black', 'Okapi Brown', '3.0L V6 TFSI', '335 hp', '8-Speed Tiptronic', 'AWD', 322000, ['Just Arrived']),
  V('audi-a7', 2022, 'Audi', 'A7 Sportback', '55 TFSI S-Line', 'Sportback', 26100, 'Daytona Grey', 'Black/Magma', '3.0L V6 TFSI', '335 hp', '7-Speed S tronic', 'AWD', 218000),
  V('audi-a6', 2023, 'Audi', 'A6', '40 TFSI Quattro', 'Sedan', 15800, 'Glacier White', 'Atlas Beige', '2.0L TFSI', '241 hp', '7-Speed S tronic', 'AWD', 174000),
  V('audi-a5-sline', 2022, 'Audi', 'A5 Coupe', '45 TFSI S-Line', 'Coupe', 24300, 'Tango Red', 'Rotor Grey', '2.0L TFSI', '261 hp', '7-Speed S tronic', 'AWD', 158000),
  V('mercedes-c63s', 2021, 'Mercedes-Benz', 'C 63 S AMG', 'Coupe', 'Coupe', 31200, 'Designo Diamond White', 'Black Nappa', '4.0L V8 Biturbo', '503 hp', 'AMG MCT 9G', 'RWD', 268000, ['Performance']),
  V('mercedes-gle53', 2022, 'Mercedes-Benz', 'GLE 53 AMG', 'Coupe', 'SUV Coupe', 22700, 'Selenite Grey', 'Macchiato Beige', '3.0L Inline-6 Hybrid', '429 hp', 'AMG SPEEDSHIFT TCT 9G', 'AWD', 348000),
  V('mercedes-e200', 2023, 'Mercedes-Benz', 'E 200', 'AMG Line', 'Sedan', 12400, 'Cavansite Blue', 'Macchiato Beige', '2.0L Inline-4', '194 hp', '9G-TRONIC', 'RWD', 198000),
  V('mercedes-c200', 2023, 'Mercedes-Benz', 'C 200', 'AMG Line', 'Sedan', 9800, 'Polar White', 'Black ARTICO', '1.5L Inline-4 EQ', '201 hp', '9G-TRONIC', 'RWD', 172000, ['Just Arrived']),
  V('tesla-model-s', 2022, 'Tesla', 'Model S', 'Long Range', 'Sedan', 19400, 'Pearl White Multi-Coat', 'Black', 'Dual Motor Electric', '670 hp', 'Single-speed', 'AWD', 286000, ['Electric']),
  V('maserati-levante', 2021, 'Maserati', 'Levante', 'Modena', 'SUV', 32800, 'Nero Ribelle', 'Nero', '3.0L V6 Twin-Turbo', '345 hp', '8-Speed ZF Auto', 'AWD', 248000),
  V('jaguar-fpace', 2022, 'Jaguar', 'F-Pace', 'R-Dynamic SE', 'SUV', 27600, 'Eiger Grey', 'Ebony', '2.0L P250 MHEV', '247 hp', '8-Speed Auto', 'AWD', 168000),
  V('landrover-discovery', 2022, 'Land Rover', 'Discovery Sport', 'R-Dynamic SE', 'SUV', 29500, 'Fuji White', 'Ebony', '2.0L P250 MHEV', '246 hp', '9-Speed Auto', 'AWD', 162000),
  V('volvo-xc90', 2022, 'Volvo', 'XC90', 'B6 Inscription', 'SUV', 33100, 'Onyx Black', 'Charcoal', '2.0L MHEV', '295 hp', '8-Speed Geartronic', 'AWD', 198000),
  V('cadillac-escalade', 2022, 'Cadillac', 'Escalade', 'Platinum', 'SUV', 36400, 'Black Raven', 'Whisper Beige', '6.2L V8', '420 hp', '10-Speed Auto', 'AWD', 358000),
  V('lincoln-navigator', 2022, 'Lincoln', 'Navigator', 'Reserve', 'SUV', 31900, 'Pristine White', 'Cappuccino', '3.5L V6 Twin-Turbo', '440 hp', '10-Speed Auto', 'AWD', 312000),
  V('ford-expedition', 2022, 'Ford', 'Expedition', 'Platinum Max', 'SUV', 38200, 'Star White', 'Sandstone', '3.5L V6 EcoBoost', '400 hp', '10-Speed Auto', '4WD', 218000),
  V('ford-ranger', 2023, 'Ford', 'Ranger', 'XLT 4x4', 'Pickup', 22100, 'Arctic White', 'Ebony', '2.3L EcoBoost', '270 hp', '10-Speed Auto', '4WD', 142000),
  V('toyota-prado', 2023, 'Toyota', 'Land Cruiser Prado', 'TXL', 'SUV', 18900, 'Pearl White', 'Beige', '2.7L Inline-4', '163 hp', '6-Speed Auto', '4WD', 168000),
  V('jeep-wrangler', 2022, 'Jeep', 'Wrangler', 'Rubicon Unlimited', 'SUV', 26800, 'Firecracker Red', 'Black', '3.6L V6 Pentastar', '285 hp', '8-Speed Auto', '4WD', 178000),
  V('infiniti-qx60', 2022, 'Infiniti', 'QX60', 'Sensory AWD', 'SUV', 28400, 'Moonbow Blue', 'Saddle Brown', '3.5L V6', '295 hp', '9-Speed Auto', 'AWD', 158000),
  V('alfa-romeo-tonale', 2023, 'Alfa Romeo', 'Tonale', 'Veloce', 'SUV', 14600, 'Misano Blue', 'Tan', '2.0L Turbo MHEV', '256 hp', '9-Speed Auto', 'AWD', 142000, ['Just Arrived']),
];

const BRANDS = [
  'Audi', 'Aston Martin', 'BMW', 'Cadillac', 'Ferrari', 'Ford', 'Infiniti', 'Jaguar',
  'Jeep', 'Land Rover', 'Lincoln', 'Maserati', 'Mercedes-Benz', 'Tesla', 'Toyota', 'Volvo', 'Alfa Romeo'
].sort();

const BODY_TYPES = ['Sedan', 'SUV', 'SUV Coupe', 'Coupe', 'Sportback', 'Pickup'];

const FUEL_TYPES = ['Petrol', 'Hybrid', 'Electric'];

// Format AED price
function fmtAED(n) {
  if (n == null) return 'Price on Application';
  return 'AED ' + n.toLocaleString('en-US');
}
function fmtMileage(n) {
  return n.toLocaleString('en-US') + ' km';
}

// Make globally available to other JSX scripts
window.VEHICLES = VEHICLES;
window.BRANDS = BRANDS;
window.BODY_TYPES = BODY_TYPES;
window.FUEL_TYPES = FUEL_TYPES;
window.fmtAED = fmtAED;
window.fmtMileage = fmtMileage;
