// ── Mock listing data ────────────────────────────────────────────
// Each listing has a `hue` used to tint its photo placeholder, and
// `video: true` flips it into a Reel (vertical agent walkthrough).

const NEIGHBORHOODS = ['Mission District', 'Noe Valley', 'Hayes Valley', 'Russian Hill', 'Sunset', 'Bernal Heights', 'Marina', 'Potrero Hill'];

const LISTINGS = [
  {
    id: 'l1', deal: 'buy', price: 1295000,
    beds: 3, baths: 2, sqft: 1740, type: 'House',
    address: '418 Fair Oaks St', hood: 'Noe Valley', city: 'San Francisco',
    hue: 28, photos: 18, video: true, badge: 'New',
    open: 'Sun 1–4pm', built: 1912, lot: '2,500 sqft', hoa: null, days: 3,
    agent: { name: 'Maya Ortega', firm: 'Anchor Residential', hue: 200 },
    blurb: 'Light-filled Edwardian with a chef’s kitchen, level backyard and a finished lower level. Steps to 24th Street.',
    features: ['Renovated kitchen', 'Private garden', 'Garage parking', 'In-unit laundry', 'Hardwood floors'],
    reelCap: 'Walk through this Noe Valley Edwardian',
  },
  {
    id: 'l2', deal: 'rent', price: 4200,
    beds: 2, baths: 2, sqft: 1100, type: 'Condo',
    address: '75 Octavia St · 4B', hood: 'Hayes Valley', city: 'San Francisco',
    hue: 210, photos: 12, video: true, badge: null,
    open: null, built: 2019, lot: null, hoa: null, days: 6,
    agent: { name: 'Devon Park', firm: 'Crest & Co', hue: 150 },
    blurb: 'Bright corner unit in a modern elevator building with shared roof deck and skyline views.',
    features: ['Roof deck', 'Elevator', 'Dishwasher', 'Pet friendly', 'Bike storage'],
    reelCap: 'Corner unit tour + roof deck views',
  },
  {
    id: 'l3', deal: 'buy', price: 879000,
    beds: 2, baths: 1, sqft: 980, type: 'Condo',
    address: '1230 Guerrero St · 3', hood: 'Mission District', city: 'San Francisco',
    hue: 45, photos: 14, video: false, badge: 'Price cut',
    open: 'Sat 2–4pm', built: 1924, lot: null, hoa: 480, days: 21,
    agent: { name: 'Lena Cho', firm: 'Anchor Residential', hue: 320 },
    blurb: 'Top-floor condo with original detailing, a sunny eat-in kitchen, and deeded storage.',
    features: ['Top floor', 'Shared garden', 'Deeded storage', 'Original details'],
    reelCap: '',
  },
  {
    id: 'l4', deal: 'rent', price: 3150,
    beds: 1, baths: 1, sqft: 720, type: 'Apartment',
    address: '2440 Larkin St · 2', hood: 'Russian Hill', city: 'San Francisco',
    hue: 165, photos: 9, video: true, badge: null,
    open: null, built: 1928, lot: null, hoa: null, days: 2,
    agent: { name: 'Theo Nakamura', firm: 'Hillside Living', hue: 25 },
    blurb: 'Classic one-bedroom with a bay window, walk-in closet and a peek of the bay.',
    features: ['Bay window', 'Walk-in closet', 'Laundry on site', 'Heat included'],
    reelCap: 'A sunny Russian Hill one-bed',
  },
  {
    id: 'l5', deal: 'buy', price: 2150000,
    beds: 4, baths: 3, sqft: 2480, type: 'House',
    address: '95 Anderson St', hood: 'Bernal Heights', city: 'San Francisco',
    hue: 12, photos: 22, video: false, badge: 'Open house',
    open: 'Sun 12–3pm', built: 1998, lot: '3,100 sqft', hoa: null, days: 9,
    agent: { name: 'Maya Ortega', firm: 'Anchor Residential', hue: 200 },
    blurb: 'Contemporary home on a quiet street with panoramic city views from the top floor great room.',
    features: ['City views', 'Two-car garage', 'Roof terrace', 'Open plan', 'Solar'],
    reelCap: '',
  },
  {
    id: 'l6', deal: 'rent', price: 5600,
    beds: 3, baths: 2, sqft: 1520, type: 'Townhouse',
    address: '188 Beaver St', hood: 'Hayes Valley', city: 'San Francisco',
    hue: 270, photos: 16, video: true, badge: 'New',
    open: null, built: 2021, lot: null, hoa: null, days: 1,
    agent: { name: 'Devon Park', firm: 'Crest & Co', hue: 150 },
    blurb: 'Three-level townhome with a private patio, two-car tandem garage and high-end finishes.',
    features: ['Private patio', 'Tandem garage', 'Smart home', 'Central AC', 'Pet friendly'],
    reelCap: 'Three levels of modern townhome',
  },
  {
    id: 'l7', deal: 'buy', price: 1495000,
    beds: 3, baths: 2, sqft: 1610, type: 'House',
    address: '662 Noe St', hood: 'Noe Valley', city: 'San Francisco',
    hue: 95, photos: 19, video: false, badge: null,
    open: 'Sat 1–4pm', built: 1905, lot: '2,200 sqft', hoa: null, days: 14,
    agent: { name: 'Lena Cho', firm: 'Anchor Residential', hue: 320 },
    blurb: 'Victorian with period charm and modern updates, plus a deep south-facing garden.',
    features: ['South-facing garden', 'Period details', 'Updated baths', 'Cellar'],
    reelCap: '',
  },
  {
    id: 'l8', deal: 'rent', price: 2750,
    beds: 1, baths: 1, sqft: 640, type: 'Apartment',
    address: '3719 Judah St · 1', hood: 'Sunset', city: 'San Francisco',
    hue: 185, photos: 8, video: true, badge: null,
    open: null, built: 1951, lot: null, hoa: null, days: 4,
    agent: { name: 'Theo Nakamura', firm: 'Hillside Living', hue: 25 },
    blurb: 'Steps from the beach — a quiet, updated one-bedroom with ocean air and an N-Judah stop outside.',
    features: ['Near beach', 'Updated kitchen', 'Laundry on site', 'Transit at door'],
    reelCap: 'Two blocks from Ocean Beach',
  },
  {
    id: 'l9', deal: 'buy', price: 998000,
    beds: 2, baths: 2, sqft: 1180, type: 'Condo',
    address: '525 Fillmore St · 5', hood: 'Marina', city: 'San Francisco',
    hue: 330, photos: 15, video: false, badge: 'Price cut',
    open: null, built: 2008, lot: null, hoa: 620, days: 28,
    agent: { name: 'Devon Park', firm: 'Crest & Co', hue: 150 },
    blurb: 'Modern two-bedroom with floor-to-ceiling windows, parking and a fitness room in the building.',
    features: ['Floor-to-ceiling windows', 'Garage parking', 'Gym', 'Doorman'],
    reelCap: '',
  },
  {
    id: 'l10', deal: 'rent', price: 3850,
    beds: 2, baths: 1, sqft: 950, type: 'Apartment',
    address: '1015 De Haro St · 3', hood: 'Potrero Hill', city: 'San Francisco',
    hue: 55, photos: 11, video: true, badge: null,
    open: null, built: 1936, lot: null, hoa: null, days: 5,
    agent: { name: 'Maya Ortega', firm: 'Anchor Residential', hue: 200 },
    blurb: 'Sunny Potrero two-bed with hardwood floors, a shared yard and easy freeway access.',
    features: ['Hardwood floors', 'Shared yard', 'Sunny exposure', 'Parking'],
    reelCap: 'Sun-soaked Potrero Hill two-bed',
  },
];

// map pin positions (x%, y%) — laid out to feel like a neighborhood map
const MAP_POS = {
  l1: [34, 64], l2: [52, 40], l3: [44, 56], l4: [60, 22], l5: [28, 78],
  l6: [50, 46], l7: [38, 60], l8: [16, 70], l9: [70, 30], l10: [58, 68],
};

const PROPERTY_TYPES = ['House', 'Condo', 'Apartment', 'Townhouse'];

// Current signed-in user (acts as both seeker + agent in this demo)
const ME = { name: 'Maya Ortega', firm: 'Anchor Residential', hue: 200, role: 'Agent' };

// Categories used by Request + Add-listing flows
const CATEGORIES = [
  { id: 'home', label: 'Home', icon: 'house', residential: true },
  { id: 'apartment', label: 'Apartment', icon: 'building', residential: true },
  { id: 'townhouse', label: 'Townhouse', icon: 'house', residential: true },
  { id: 'shop', label: 'Shop / Retail', icon: 'store', residential: false },
  { id: 'building', label: 'Commercial', icon: 'building', residential: false },
  { id: 'office', label: 'Office', icon: 'doc', residential: false },
  { id: 'farm', label: 'Farm', icon: 'land', residential: false },
  { id: 'land', label: 'Land / Plot', icon: 'land', residential: false },
];

// Sample requests the user has already posted
const MY_REQUESTS = [
  { id: 'r1', deal: 'buy', cat: 'home', area: 'Noe Valley · Bernal Heights',
    budget: '$900k – $1.4M', beds: '3+', baths: '2+', when: 'Next 3 months',
    note: 'Single-family with outdoor space and a garage. Quiet street preferred.',
    status: 'Active', matches: 6, created: '2 days ago' },
  { id: 'r2', deal: 'rent', cat: 'shop', area: 'Hayes Valley · Mission',
    budget: '$4k – $7k / mo', beds: null, baths: null, when: 'Flexible',
    note: 'Ground-floor retail ~800–1,200 sqft with foot traffic for a coffee bar.',
    status: 'Active', matches: 2, created: '1 week ago' },
];

function fmtPrice(l) {
  if (l.deal === 'rent') return '$' + l.price.toLocaleString() + '/mo';
  return '$' + l.price.toLocaleString();
}
function fmtPriceShort(l) {
  if (l.deal === 'rent') return '$' + (l.price / 1000).toFixed(1).replace('.0', '') + 'k';
  return '$' + (l.price / 1000000).toFixed(2).replace(/0$/, '') + 'M';
}

Object.assign(window, {
  LISTINGS, MAP_POS, NEIGHBORHOODS, PROPERTY_TYPES, ME, CATEGORIES, MY_REQUESTS, fmtPrice, fmtPriceShort,
});
