-- ============================================================
-- rEvents Demo Seed Data
--
-- Spatial schema:  lat/lng (WGS84), location_name, location_address
--                  metadata.spatial_granularity (rcal-compatible: 0=planet..8=coordinates)
--                  metadata.location_breadcrumb (hierarchy string)
--                  metadata.geo (GeoJSON Point for rmaps interop)
--
-- Temporal schema: ISO 8601 start/end (UTC), timezone_str (IANA),
--                  rrule (iCal RFC 5545), all_day, is_recurring
--
-- rStack interop:  r_tool_source, r_tool_entity_id, metadata.feeds
-- ============================================================

BEGIN;

-- ── Demo user (system seed account) ──

INSERT INTO users (id, did, username, created_at, updated_at) VALUES
  ('demo-seed-user', 'did:key:z6MkDemo000000000000000000000000000seed', 'demo', NOW(), NOW())
ON CONFLICT (id) DO NOTHING;

-- ── Event Sources ──

INSERT INTO event_sources (id, name, source_type, color, is_active, config, event_count, created_by_id, space_slug, created_at, updated_at) VALUES
  ('src-luma-demo',    'Luma — Web3 Events',         'luma',    '#f472b6', true, '{"calendar_slug":"web3-weekly"}',  0, 'demo-seed-user', 'demo', NOW(), NOW()),
  ('src-meetup-demo',  'Meetup — Tech Talks',        'meetup',  '#fb923c', true, '{"group_slug":"tech-talks-global"}', 0, 'demo-seed-user', 'demo', NOW(), NOW()),
  ('src-ical-demo',    'iCal — Conference Circuit',   'ical',    '#60a5fa', true, '{"feed_url":"https://example.com/conferences.ics"}', 0, 'demo-seed-user', 'demo', NOW(), NOW()),
  ('src-manual-demo',  'Manual / Parsed Events',      'manual',  '#a78bfa', true, '{}', 0, 'demo-seed-user', 'demo', NOW(), NOW()),
  ('src-rss-demo',     'RSS — Community Digest',      'rss',     '#34d399', true, '{"feed_url":"https://example.com/events.rss"}', 0, 'demo-seed-user', 'demo', NOW(), NOW())
ON CONFLICT (id) DO NOTHING;


-- ── Events ──
-- All dates are relative to "now" so the demo stays fresh.
-- We use fixed offsets from 2026-03-14 but feel free to re-seed.

INSERT INTO events (
  id, source_id, external_id, external_url,
  title, description, start, "end", all_day, timezone_str, rrule, is_recurring,
  location_name, location_address, latitude, longitude,
  is_virtual, virtual_url, virtual_platform,
  organizer_name, organizer_email, organizer_url,
  attendee_count, max_attendees, rsvp_url,
  status, visibility, category, tags, image_url, cost,
  r_tool_source, r_tool_entity_id, synced_to_rcal, metadata,
  created_by_id, space_slug, created_at, updated_at
) VALUES

-- ────────────────────────────────────────────────────────────
-- 1. In-person conference — Berlin
-- ────────────────────────────────────────────────────────────
(
  'evt-001', 'src-luma-demo', 'luma-evt-9a3f', 'https://lu.ma/web3-berlin-2026',
  'Web3 Berlin Summit 2026',
  'Three-day summit covering decentralized governance, token engineering, and regenerative finance. Workshops, panels, and unconference tracks.',
  '2026-04-15 09:00:00+00', '2026-04-17 18:00:00+00', false, 'Europe/Berlin',
  '', false,
  'Funkhaus Berlin', 'Nalepastraße 18, 12459 Berlin, Germany',
  52.4631, 13.4998,
  false, '', '',
  'Web3 Berlin e.V.', 'hello@web3berlin.dev', 'https://web3berlin.dev',
  450, 800, 'https://lu.ma/web3-berlin-2026',
  'confirmed', 'public', 'conference',
  ARRAY['web3', 'governance', 'token-engineering', 'regen-finance', 'berlin'],
  '', '€120 early-bird / €200 regular',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > Europe > Germany > Berlin > Treptow-Köpenick > Funkhaus Berlin", "geo": {"type": "Point", "coordinates": [13.4998, 52.4631]}, "feeds": {"rcal": {"sync": true, "calendar": "community"}, "rmaps": {"pin": true, "layer": "events"}}, "duration_days": 3, "format": "multi-track"}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 2. Recurring weekly meetup — San Francisco (hybrid)
-- ────────────────────────────────────────────────────────────
(
  'evt-002', 'src-meetup-demo', 'meetup-evt-4b2c', 'https://meetup.com/tech-talks-sf/events/weekly',
  'Bay Area Tech Talks — Weekly',
  'Informal weekly gathering for developers, designers, and product folks. Lightning talks + open discussion. Pizza provided.',
  '2026-03-20 18:30:00+00', '2026-03-20 20:30:00+00', false, 'America/Los_Angeles',
  'FREQ=WEEKLY;BYDAY=FR;COUNT=52', true,
  'Noisebridge Hackerspace', '2169 Mission St, San Francisco, CA 94110, USA',
  37.7627, -122.4190,
  true, 'https://meet.jit.si/tech-talks-sf', 'jitsi',
  'SF Tech Community', 'organizers@techtalkssf.org', 'https://meetup.com/tech-talks-sf',
  35, 60, 'https://meetup.com/tech-talks-sf/events/weekly',
  'confirmed', 'public', 'meetup',
  ARRAY['tech-talks', 'lightning-talks', 'san-francisco', 'weekly', 'hybrid'],
  '', 'Free',
  'rcal', 'rcal-weekly-sf-001', true,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > North America > USA > California > San Francisco > Mission District > Noisebridge", "geo": {"type": "Point", "coordinates": [-122.4190, 37.7627]}, "feeds": {"rcal": {"sync": true, "calendar": "community", "recurrence_expanded": false}, "rinbox": {"notify": true, "digest": "weekly"}}, "format": "lightning-talks", "hybrid": true}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 3. All-day festival — Lisbon
-- ────────────────────────────────────────────────────────────
(
  'evt-003', 'src-ical-demo', 'ical-evt-7e1d', 'https://example.com/refi-lisbon',
  'ReFi Lisbon — Regenerative Finance Festival',
  'A full-day festival exploring regenerative economics, community currencies, and ecological accounting. Outdoor venue with live music and food stalls.',
  '2026-05-22 00:00:00+00', '2026-05-22 23:59:59+00', true, 'Europe/Lisbon',
  '', false,
  'LX Factory', 'R. Rodrigues de Faria 103, 1300-501 Lisboa, Portugal',
  38.7036, -9.1782,
  false, '', '',
  'ReFi DAO', 'events@refidao.org', 'https://refidao.org',
  280, 500, 'https://example.com/refi-lisbon/rsvp',
  'confirmed', 'public', 'festival',
  ARRAY['refi', 'regenerative-finance', 'community-currencies', 'lisbon', 'outdoor'],
  '', '€30 suggested donation',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > Europe > Portugal > Lisboa > Alcântara > LX Factory", "geo": {"type": "Point", "coordinates": [-9.1782, 38.7036]}, "feeds": {"rcal": {"sync": true, "calendar": "festivals"}, "rmaps": {"pin": true, "layer": "festivals"}, "rphotos": {"album": "refi-lisbon-2026"}}, "format": "festival", "outdoor": true}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 4. Virtual workshop — no physical location
-- ────────────────────────────────────────────────────────────
(
  'evt-004', 'src-manual-demo', 'manual-evt-001', '',
  'Token Engineering Workshop: Bonding Curves',
  'Hands-on workshop covering bonding curve design, simulation with cadCAD, and parameter selection for token launches. Bring your laptop and Python environment.',
  '2026-03-28 15:00:00+00', '2026-03-28 17:30:00+00', false, 'UTC',
  '', false,
  '', '',
  NULL, NULL,
  true, 'https://zoom.us/j/123456789', 'zoom',
  'Token Engineering Commons', 'workshops@tecommons.org', 'https://tecommons.org',
  42, 100, 'https://tecommons.org/workshops/bonding-curves',
  'confirmed', 'public', 'workshop',
  ARRAY['token-engineering', 'bonding-curves', 'cadcad', 'simulation', 'virtual'],
  '', 'Free (donation welcome)',
  'rcal', 'rcal-ws-tec-042', true,
  '{"spatial_granularity": 0, "location_breadcrumb": "Virtual (Global)", "geo": null, "feeds": {"rcal": {"sync": true, "calendar": "workshops"}, "rinbox": {"notify": true}}, "format": "hands-on-workshop", "prerequisites": ["Python 3.10+", "cadCAD installed"], "recording_available": true}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 5. Biweekly recurring — London pub social
-- ────────────────────────────────────────────────────────────
(
  'evt-005', 'src-meetup-demo', 'meetup-evt-8f3a', 'https://meetup.com/crypto-pints-london',
  'Crypto Pints — London Biweekly',
  'Casual pub meetup for crypto and Web3 builders. No agenda, just good conversations over drinks. All welcome, from curious newcomers to seasoned devs.',
  '2026-03-26 18:00:00+00', '2026-03-26 21:00:00+00', false, 'Europe/London',
  'FREQ=WEEKLY;INTERVAL=2;BYDAY=TH;COUNT=26', true,
  'The Old Fountain', '3 Baldwin St, London EC1V 9NU, UK',
  51.5248, -0.0894,
  false, '', '',
  'London Crypto Social', 'hello@cryptopints.london', 'https://cryptopints.london',
  25, NULL, 'https://meetup.com/crypto-pints-london',
  'confirmed', 'public', 'social',
  ARRAY['crypto', 'social', 'london', 'pub', 'biweekly', 'networking'],
  '', 'Free (buy your own drinks)',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > Europe > UK > England > London > Clerkenwell > The Old Fountain", "geo": {"type": "Point", "coordinates": [-0.0894, 51.5248]}, "feeds": {"rcal": {"sync": true, "calendar": "socials"}, "rmaps": {"pin": true, "layer": "socials"}}, "format": "informal", "accessibility": {"wheelchair": true, "transit_nearby": "Old Street station"}}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 6. Multi-day hackathon — Denver (hybrid)
-- ────────────────────────────────────────────────────────────
(
  'evt-006', 'src-luma-demo', 'luma-evt-c2d9', 'https://lu.ma/ethdenver-hack-2026',
  'ETHDenver 2026 — Community Hackathon',
  'The annual ETHDenver hackathon. Build, ship, and present your project in 48 hours. Tracks: DeFi, Social, Governance, Infrastructure. Meals and sleeping pods provided.',
  '2026-06-12 09:00:00+00', '2026-06-14 17:00:00+00', false, 'America/Denver',
  '', false,
  'National Western Complex', '4655 Humboldt St, Denver, CO 80216, USA',
  39.7825, -104.9714,
  true, 'https://stream.ethdenver.com', 'custom',
  'ETHDenver', 'buidl@ethdenver.com', 'https://ethdenver.com',
  1200, 2000, 'https://lu.ma/ethdenver-hack-2026',
  'confirmed', 'public', 'hackathon',
  ARRAY['ethereum', 'hackathon', 'denver', 'defi', 'governance', 'buidl'],
  '', '$50 builder pass',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > North America > USA > Colorado > Denver > Globeville > National Western Complex", "geo": {"type": "Point", "coordinates": [-104.9714, 39.7825]}, "feeds": {"rcal": {"sync": true, "calendar": "hackathons"}, "rmaps": {"pin": true, "layer": "hackathons", "radius_meters": 500}, "rtrips": {"destination": true}}, "format": "hackathon", "hybrid": true, "duration_hours": 56, "tracks": ["DeFi", "Social", "Governance", "Infrastructure"], "prizes_usd": 100000}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 7. Monthly community call — virtual, recurring
-- ────────────────────────────────────────────────────────────
(
  'evt-007', 'src-ical-demo', 'ical-evt-2a4f', '',
  'rStack Community Call',
  'Monthly all-hands for the rStack ecosystem. Module updates, roadmap discussion, open Q&A. Everyone building on or with rStack is welcome.',
  '2026-04-01 16:00:00+00', '2026-04-01 17:00:00+00', false, 'UTC',
  'FREQ=MONTHLY;BYDAY=1TU;COUNT=12', true,
  '', '',
  NULL, NULL,
  true, 'https://meet.jit.si/rstack-community', 'jitsi',
  'rStack Core Team', 'community@rstack.online', 'https://rstack.online',
  65, NULL, '',
  'confirmed', 'public', 'community-call',
  ARRAY['rstack', 'community', 'monthly', 'governance', 'virtual'],
  '', 'Free',
  'rcal', 'rcal-rstack-monthly', true,
  '{"spatial_granularity": 0, "location_breadcrumb": "Virtual (Global)", "geo": null, "feeds": {"rcal": {"sync": true, "calendar": "rstack"}, "rinbox": {"notify": true, "digest": "monthly"}, "rnotes": {"auto_capture": true, "template": "meeting-notes"}, "rtube": {"record": true, "playlist": "community-calls"}}, "format": "community-call", "recording_available": true, "agenda_url": "https://rstack.online/community/calls"}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 8. Workshop series — Tokyo (in-person)
-- ────────────────────────────────────────────────────────────
(
  'evt-008', 'src-manual-demo', 'manual-evt-002', '',
  'DAO Governance Design Sprint — Tokyo',
  'Intensive 2-day design sprint on DAO governance patterns. Day 1: Theory & case studies. Day 2: Hands-on mechanism design with your team. Limited to 30 participants for deep engagement.',
  '2026-05-10 09:30:00+00', '2026-05-11 17:00:00+00', false, 'Asia/Tokyo',
  '', false,
  'Impact HUB Tokyo', '2-11-3 Meguro, Meguro-ku, Tokyo 153-0063, Japan',
  35.6334, 139.7085,
  false, '', '',
  'DAOhaus Asia', 'tokyo@daohaus.club', 'https://daohaus.club',
  18, 30, 'https://daohaus.club/tokyo-sprint',
  'confirmed', 'public', 'workshop',
  ARRAY['dao', 'governance', 'mechanism-design', 'tokyo', 'design-sprint'],
  '', '¥15,000',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > Asia > Japan > Tokyo > Meguro-ku > Impact HUB Tokyo", "geo": {"type": "Point", "coordinates": [139.7085, 35.6334]}, "feeds": {"rcal": {"sync": true, "calendar": "workshops"}, "rmaps": {"pin": true, "layer": "workshops"}, "rtrips": {"destination": true, "region": "Tokyo"}}, "format": "design-sprint", "language": "en+ja", "capacity": 30}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 9. Tentative / unconfirmed — Nairobi
-- ────────────────────────────────────────────────────────────
(
  'evt-009', 'src-rss-demo', 'rss-evt-n01', 'https://example.com/refi-nairobi',
  'ReFi Nairobi — Community Land Trust Workshop',
  'Exploring community land trusts and ecological asset tokenization in the East African context. Co-hosted with local land stewardship organizations. Venue TBC.',
  '2026-07-08 10:00:00+00', '2026-07-08 16:00:00+00', false, 'Africa/Nairobi',
  '', false,
  'iHub Nairobi', '6th Floor, Senteu Plaza, Galana Rd, Nairobi, Kenya',
  -1.3003, 36.7861,
  false, '', '',
  'ReFi Kenya', 'nairobi@refi.ke', 'https://refi.ke',
  0, 80, '',
  'tentative', 'public', 'workshop',
  ARRAY['refi', 'community-land-trust', 'nairobi', 'ecological-assets', 'tokenization'],
  '', 'Free',
  NULL, NULL, false,
  '{"spatial_granularity": 5, "location_breadcrumb": "Earth > Africa > Kenya > Nairobi > Kilimani > iHub", "geo": {"type": "Point", "coordinates": [36.7861, -1.3003]}, "feeds": {"rcal": {"sync": false, "reason": "tentative"}, "rmaps": {"pin": true, "layer": "upcoming", "style": "dashed"}}, "format": "workshop", "status_note": "Venue and date subject to confirmation"}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 10. Past event (for timeline completeness) — Buenos Aires
-- ────────────────────────────────────────────────────────────
(
  'evt-010', 'src-luma-demo', 'luma-evt-ba01', 'https://lu.ma/latam-dao-summit',
  'LatAm DAO Summit — Buenos Aires',
  'Regional summit on DAO tooling and governance in Latin America. Keynotes in Spanish and English. Streamed globally.',
  '2026-02-20 10:00:00+00', '2026-02-21 18:00:00+00', false, 'America/Argentina/Buenos_Aires',
  '', false,
  'Centro Cultural Kirchner (CCK)', 'Sarmiento 151, C1041 Buenos Aires, Argentina',
  -34.6039, -58.3697,
  true, 'https://stream.example.com/latam-dao', 'youtube',
  'LatAm DAO Collective', 'info@latam-dao.org', 'https://latam-dao.org',
  350, 400, 'https://lu.ma/latam-dao-summit',
  'confirmed', 'public', 'conference',
  ARRAY['dao', 'latam', 'buenos-aires', 'governance', 'spanish', 'bilingual'],
  '', 'ARS 5000 / $5 USD',
  'rcal', 'rcal-latam-dao-2026', true,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > South America > Argentina > Buenos Aires > San Nicolás > CCK", "geo": {"type": "Point", "coordinates": [-58.3697, -34.6039]}, "feeds": {"rcal": {"sync": true, "calendar": "conferences"}, "rmaps": {"pin": true, "layer": "conferences"}, "rtube": {"playlist": "latam-dao-summit-2026", "recording_count": 12}, "rtrips": {"destination": true, "region": "Buenos Aires"}}, "format": "multi-track", "hybrid": true, "languages": ["es", "en"]}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 11. Cancelled event (status lifecycle demo)
-- ────────────────────────────────────────────────────────────
(
  'evt-011', 'src-ical-demo', 'ical-evt-x01', '',
  'DeFi Security Summit — Singapore (CANCELLED)',
  'Originally planned security-focused summit. Cancelled due to venue conflict. Will be rescheduled for Q4 2026.',
  '2026-04-20 09:00:00+00', '2026-04-20 18:00:00+00', false, 'Asia/Singapore',
  '', false,
  'Marina Bay Sands Expo', '10 Bayfront Ave, Singapore 018956',
  1.2834, 103.8607,
  false, '', '',
  'DeFi Security Alliance', 'events@defisec.org', 'https://defisec.org',
  0, 300, '',
  'cancelled', 'public', 'conference',
  ARRAY['defi', 'security', 'singapore', 'cancelled'],
  '', '$200',
  NULL, NULL, false,
  '{"spatial_granularity": 7, "location_breadcrumb": "Earth > Asia > Singapore > Marina Bay > MBS Expo", "geo": {"type": "Point", "coordinates": [103.8607, 1.2834]}, "feeds": {"rcal": {"sync": true, "status": "cancelled"}}, "cancellation_reason": "venue conflict", "reschedule_target": "Q4 2026"}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 12. Neighborhood-scale event — Portland community garden
-- ────────────────────────────────────────────────────────────
(
  'evt-012', 'src-manual-demo', 'manual-evt-003', '',
  'Community Garden Workday & Seed Swap',
  'Monthly neighborhood workday at the community garden. Bring gloves, tools provided. Seed swap table — bring seeds to share! Potluck lunch at noon.',
  '2026-04-05 09:00:00+00', '2026-04-05 14:00:00+00', false, 'America/Los_Angeles',
  'FREQ=MONTHLY;BYDAY=1SA;COUNT=8', true,
  'Sunnyside Community Garden', '3555 SE Yamhill St, Portland, OR 97214, USA',
  45.5152, -122.6283,
  false, '', '',
  'Sunnyside Neighborhood Association', 'garden@sunnysidepdx.org', '',
  12, 30, '',
  'confirmed', 'public', 'community',
  ARRAY['garden', 'community', 'portland', 'seed-swap', 'volunteer', 'monthly', 'outdoor'],
  '', 'Free',
  NULL, NULL, false,
  '{"spatial_granularity": 6, "location_breadcrumb": "Earth > North America > USA > Oregon > Portland > Sunnyside > Community Garden", "geo": {"type": "Point", "coordinates": [-122.6283, 45.5152]}, "feeds": {"rcal": {"sync": true, "calendar": "community"}, "rmaps": {"pin": true, "layer": "community", "icon": "garden"}}, "format": "workday", "outdoor": true, "bring": ["gloves", "seeds to swap"], "accessibility": {"wheelchair": false, "terrain": "garden paths"}}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 13. City-scale — Barcelona coordination event
-- ────────────────────────────────────────────────────────────
(
  'evt-013', 'src-rss-demo', 'rss-evt-bcn01', 'https://example.com/cosmolocal-bcn',
  'Cosmolocal Coordination Assembly — Barcelona',
  'Quarterly assembly for Barcelona''s cosmolocal production network. Topics: mutual aid logistics, shared tool libraries, and inter-neighborhood resource flows.',
  '2026-04-12 10:00:00+00', '2026-04-12 15:00:00+00', false, 'Europe/Madrid',
  'FREQ=MONTHLY;INTERVAL=3;BYDAY=2SA;COUNT=4', true,
  'Can Batlló', 'Carrer de la Constitució 19, 08014 Barcelona, Spain',
  41.3732, 2.1372,
  false, '', '',
  'Barcelona Commons Network', 'assembly@bcncommons.cat', 'https://bcncommons.cat',
  55, 100, 'https://example.com/cosmolocal-bcn/rsvp',
  'confirmed', 'public', 'assembly',
  ARRAY['cosmolocal', 'barcelona', 'mutual-aid', 'commons', 'assembly', 'quarterly'],
  '', 'Free',
  NULL, NULL, false,
  '{"spatial_granularity": 5, "location_breadcrumb": "Earth > Europe > Spain > Catalonia > Barcelona > Sants-Montjuïc > Can Batlló", "geo": {"type": "Point", "coordinates": [2.1372, 41.3732]}, "feeds": {"rcal": {"sync": true, "calendar": "assemblies"}, "rmaps": {"pin": true, "layer": "governance"}, "rchoices": {"proposals_expected": true}, "rvote": {"governance_session": true}}, "format": "assembly", "language": "ca+es+en", "decision_protocol": "consent-based"}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 14. Bioregional event — Pacific Northwest
-- ────────────────────────────────────────────────────────────
(
  'evt-014', 'src-manual-demo', 'manual-evt-004', '',
  'Cascadia Bioregional Congress 2026',
  'Annual gathering of the Cascadia bioregion. Watershed mapping, indigenous land stewardship panels, mycelium networking workshops, and collaborative governance sessions. Camping available on-site.',
  '2026-08-15 08:00:00+00', '2026-08-17 16:00:00+00', false, 'America/Los_Angeles',
  '', false,
  'Breitenbush Hot Springs', 'PO Box 578, Detroit, OR 97342, USA',
  44.7819, -121.9733,
  false, '', '',
  'Cascadia Bioregion Project', 'congress@cascadiabioregion.org', 'https://cascadiabioregion.org',
  120, 200, 'https://cascadiabioregion.org/congress-2026',
  'confirmed', 'public', 'conference',
  ARRAY['bioregion', 'cascadia', 'indigenous', 'watershed', 'mycelium', 'governance', 'camping'],
  '', '$150 sliding scale (includes meals + camping)',
  NULL, NULL, false,
  '{"spatial_granularity": 2, "location_breadcrumb": "Earth > North America > Cascadia Bioregion > Oregon Cascades > Breitenbush", "geo": {"type": "Point", "coordinates": [-121.9733, 44.7819]}, "bioregion": "Cascadia", "feeds": {"rcal": {"sync": true, "calendar": "bioregional"}, "rmaps": {"pin": true, "layer": "bioregional", "boundary_geojson": "cascadia-bioregion"}, "rtrips": {"destination": true, "region": "Oregon Cascades", "transport_notes": "2hr drive from Portland, shuttle available"}}, "format": "congress", "outdoor": true, "accommodation": "camping", "meals_included": true}',
  'demo-seed-user', 'demo', NOW(), NOW()
),

-- ────────────────────────────────────────────────────────────
-- 15. Planet-scale — Global Climate Hackathon
-- ────────────────────────────────────────────────────────────
(
  'evt-015', 'src-ical-demo', 'ical-evt-gh01', 'https://example.com/climate-hack-global',
  'Global Climate Hackathon 2026',
  '48-hour distributed hackathon across all time zones. Build open-source tools for climate monitoring, carbon accounting, and ecological regeneration. Local hubs in 30+ cities.',
  '2026-09-20 00:00:00+00', '2026-09-21 23:59:59+00', true, 'UTC',
  '', false,
  'Distributed — 30+ city hubs worldwide', 'Global',
  NULL, NULL,
  true, 'https://climate-hack.earth/2026', 'custom',
  'Climate Hack Foundation', 'hello@climate-hack.earth', 'https://climate-hack.earth',
  3500, 10000, 'https://climate-hack.earth/2026/register',
  'confirmed', 'public', 'hackathon',
  ARRAY['climate', 'hackathon', 'global', 'open-source', 'distributed', 'carbon', 'regeneration'],
  '', 'Free',
  NULL, NULL, false,
  '{"spatial_granularity": 0, "location_breadcrumb": "Earth (Distributed)", "geo": null, "hub_cities": ["Berlin", "San Francisco", "Tokyo", "Nairobi", "São Paulo", "London", "Mumbai", "Sydney"], "feeds": {"rcal": {"sync": true, "calendar": "hackathons"}, "rmaps": {"pins": "multi", "layer": "hackathons"}, "rdata": {"metrics": true, "track": ["participants", "projects", "commits"]}}, "format": "distributed-hackathon", "tracks": ["Monitoring", "Carbon Accounting", "Ecological Regeneration", "Policy Tools"], "prizes_usd": 50000}',
  'demo-seed-user', 'demo', NOW(), NOW()
);

-- ── Update event_count on sources ──

UPDATE event_sources SET event_count = (
  SELECT count(*) FROM events WHERE events.source_id = event_sources.id
);

COMMIT;
