-- CREdispo Seed Data
-- password_hash is bcrypt of "demo123"
-- Generated with: await bcrypt.hash("demo123", 10)
-- Using a pre-computed bcrypt hash for "demo123"

-- ============================================
-- USERS (3 users: admin, agent, buyer)
-- ============================================
INSERT INTO users (id, email, password_hash, role, name, company, phone) VALUES
  ('00000000-0000-0000-0000-000000000001', 'admin@credispo.com',
   '$2b$10$lBN2nUOtIsWhR73IlzDGguDdoVfIt3Y59YkFSQbv.XpkpSvztCwJu',
   'admin', 'Admin User', 'CREdispo', '(555) 100-0001'),
  ('00000000-0000-0000-0000-000000000002', 'john@brokerage.com',
   '$2b$10$lBN2nUOtIsWhR73IlzDGguDdoVfIt3Y59YkFSQbv.XpkpSvztCwJu',
   'agent', 'John Doe', 'Doe Brokerage', '(555) 100-0002'),
  ('00000000-0000-0000-0000-000000000003', 'robert@thompsonfamily.com',
   '$2b$10$lBN2nUOtIsWhR73IlzDGguDdoVfIt3Y59YkFSQbv.XpkpSvztCwJu',
   'buyer', 'Robert Thompson', 'Thompson Family Office', '(305) 555-0505');

-- ============================================
-- SELLER LEADS (6 leads from mock data)
-- ============================================
INSERT INTO seller_leads (id, agent_id, address, asset_type, asking_price, cap_rate, noi, sqft, units, year_built, market, city, state, notes, status, created_at, updated_at) VALUES
  ('10000000-0000-0000-0000-000000000001',
   '00000000-0000-0000-0000-000000000002',
   '1250 Broadway, 15th Floor', 'Office', 12500000, 6.25, 781250, 45000, NULL, 2001,
   'New York, NY', 'New York', 'NY',
   'Class A office with 95% occupancy. Long-term tenants with staggered lease expirations.',
   'active', NOW() - INTERVAL '2 days', NOW() - INTERVAL '2 days'),

  ('10000000-0000-0000-0000-000000000002',
   '00000000-0000-0000-0000-000000000002',
   '8900 Collins Ave', 'Multifamily', 28000000, 5.10, 1428000, 120000, 156, 2018,
   'Miami, FL', 'Miami', 'FL',
   'Luxury waterfront multifamily. Amenity-rich with pool, gym, rooftop lounge. 97% occupied.',
   'active', NOW() - INTERVAL '5 days', NOW() - INTERVAL '1 day'),

  ('10000000-0000-0000-0000-000000000003',
   '00000000-0000-0000-0000-000000000002',
   '4500 Industrial Blvd', 'Industrial', 8750000, 7.20, 630000, 85000, NULL, 2015,
   'Dallas, TX', 'Dallas', 'TX',
   'Modern distribution warehouse with 32ft clear height. Triple net lease with 8 years remaining.',
   'matched', NOW() - INTERVAL '10 days', NOW() - INTERVAL '3 days'),

  ('10000000-0000-0000-0000-000000000004',
   '00000000-0000-0000-0000-000000000002',
   '200 Peachtree St NW', 'Retail', 4200000, 6.80, 285600, 18000, NULL, 1998,
   'Atlanta, GA', 'Atlanta', 'GA',
   'Strip center anchored by national grocery tenant. 3 inline suites with local tenants.',
   'active', NOW() - INTERVAL '1 day', NOW() - INTERVAL '1 day'),

  ('10000000-0000-0000-0000-000000000005',
   '00000000-0000-0000-0000-000000000002',
   '750 Congress Ave', 'Mixed-Use', 15800000, 5.80, 916400, 62000, 48, 2020,
   'Austin, TX', 'Austin', 'TX',
   'Mixed-use with ground floor retail and 48 residential units above. Downtown location.',
   'pending', NOW() - INTERVAL '7 days', NOW() - INTERVAL '4 days'),

  ('10000000-0000-0000-0000-000000000006',
   '00000000-0000-0000-0000-000000000002',
   '1100 S Ocean Blvd', 'Hospitality', 35000000, 4.50, 1575000, 95000, 120, 2010,
   'Miami, FL', 'Palm Beach', 'FL',
   'Boutique hotel on the beach. Recently renovated. Strong RevPAR metrics.',
   'active', NOW() - INTERVAL '3 days', NOW() - INTERVAL '3 days');

-- ============================================
-- BUYERS (8 buyers from mock data)
-- ============================================
INSERT INTO buyers (id, agent_id, user_id, name, company, email, phone, asset_types, target_locations, price_min, price_max, cap_rate_min, cap_rate_max, preferences, status, engagement_score, last_contacted_at, created_at, updated_at) VALUES
  ('20000000-0000-0000-0000-000000000001',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Marcus Williams', 'Blackstone Capital Partners', 'marcus@blackstonecap.com', '(212) 555-0101',
   ARRAY['Office','Mixed-Use'], ARRAY['New York, NY','Boston, MA','Chicago, IL'],
   5000000, 50000000, 5.0, 7.5,
   'Class A properties, value-add opportunities',
   'high-intent', 92, NOW() - INTERVAL '1 day',
   NOW() - INTERVAL '30 days', NOW() - INTERVAL '1 day'),

  ('20000000-0000-0000-0000-000000000002',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Sarah Chen', 'Pacific Capital Group', 'sarah@pacificcap.com', '(310) 555-0202',
   ARRAY['Multifamily','Mixed-Use'], ARRAY['Miami, FL','Tampa, FL','Orlando, FL','Atlanta, GA'],
   10000000, 75000000, 4.5, 6.5,
   'New construction preferred, 100+ units',
   'active', 78, NOW() - INTERVAL '3 days',
   NOW() - INTERVAL '45 days', NOW() - INTERVAL '2 days'),

  ('20000000-0000-0000-0000-000000000003',
   '00000000-0000-0000-0000-000000000002', NULL,
   'David Rodriguez', 'Lone Star Investments', 'david@lonestarinv.com', '(214) 555-0303',
   ARRAY['Industrial','Land'], ARRAY['Dallas, TX','Houston, TX','Austin, TX','San Antonio, TX'],
   3000000, 25000000, 6.0, 9.0,
   'NNN leases, distribution/warehouse, last-mile logistics',
   'active', 85, NOW() - INTERVAL '2 days',
   NOW() - INTERVAL '60 days', NOW() - INTERVAL '1 day'),

  ('20000000-0000-0000-0000-000000000004',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Jennifer Park', 'Summit Realty Advisors', 'jennifer@summitrealtyad.com', '(404) 555-0404',
   ARRAY['Retail','Mixed-Use'], ARRAY['Atlanta, GA','Charlotte, NC','Nashville, TN'],
   2000000, 15000000, 5.5, 8.0,
   'Anchored retail, grocery-anchored preferred',
   'active', 67, NOW() - INTERVAL '7 days',
   NOW() - INTERVAL '90 days', NOW() - INTERVAL '5 days'),

  ('20000000-0000-0000-0000-000000000005',
   '00000000-0000-0000-0000-000000000002',
   '00000000-0000-0000-0000-000000000003',
   'Robert Thompson', 'Thompson Family Office', 'robert@thompsonfamily.com', '(305) 555-0505',
   ARRAY['Multifamily','Hospitality'], ARRAY['Miami, FL','Tampa, FL','Nationwide'],
   15000000, 100000000, 4.0, 6.0,
   '1031 exchange buyer, luxury properties, waterfront',
   'high-intent', 95, NOW() - INTERVAL '1 day',
   NOW() - INTERVAL '20 days', NOW() - INTERVAL '1 day'),

  ('20000000-0000-0000-0000-000000000006',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Amanda Foster', 'Greenfield Development', 'amanda@greenfielddev.com', '(512) 555-0606',
   ARRAY['Land','Multifamily'], ARRAY['Austin, TX','Dallas, TX','Denver, CO','Phoenix, AZ'],
   1000000, 20000000, NULL, NULL,
   'Development sites, entitled land, value-add multifamily',
   'active', 54, NOW() - INTERVAL '14 days',
   NOW() - INTERVAL '120 days', NOW() - INTERVAL '10 days'),

  ('20000000-0000-0000-0000-000000000007',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Michael Chang', 'Horizon Capital', 'michael@horizoncap.com', '(312) 555-0707',
   ARRAY['Office','Industrial'], ARRAY['Chicago, IL','Minneapolis, MN'],
   8000000, 40000000, 6.0, 8.5,
   'Stabilized assets, long-term hold',
   'unresponsive', 23, NOW() - INTERVAL '30 days',
   NOW() - INTERVAL '180 days', NOW() - INTERVAL '30 days'),

  ('20000000-0000-0000-0000-000000000008',
   '00000000-0000-0000-0000-000000000002', NULL,
   'Lisa Nguyen', 'Evergreen REIT', 'lisa@evergreenreit.com', '(206) 555-0808',
   ARRAY['Multifamily','Office','Retail'], ARRAY['Nationwide'],
   20000000, 200000000, 4.5, 7.0,
   'Core and core-plus, ESG-focused',
   'active', 71, NOW() - INTERVAL '5 days',
   NOW() - INTERVAL '60 days', NOW() - INTERVAL '3 days');

-- ============================================
-- MATCHES (8 matches from mock data)
-- ============================================
INSERT INTO matches (id, lead_id, buyer_id, match_score, status, created_at, updated_at) VALUES
  ('30000000-0000-0000-0000-000000000001',
   '10000000-0000-0000-0000-000000000001', '20000000-0000-0000-0000-000000000001',
   94.50, 'sent', NOW() - INTERVAL '2 days', NOW() - INTERVAL '1 day'),

  ('30000000-0000-0000-0000-000000000002',
   '10000000-0000-0000-0000-000000000002', '20000000-0000-0000-0000-000000000002',
   91.20, 'interested', NOW() - INTERVAL '5 days', NOW() - INTERVAL '2 days'),

  ('30000000-0000-0000-0000-000000000003',
   '10000000-0000-0000-0000-000000000002', '20000000-0000-0000-0000-000000000005',
   88.70, 'sent', NOW() - INTERVAL '5 days', NOW() - INTERVAL '3 days'),

  ('30000000-0000-0000-0000-000000000004',
   '10000000-0000-0000-0000-000000000003', '20000000-0000-0000-0000-000000000003',
   96.10, 'interested', NOW() - INTERVAL '10 days', NOW() - INTERVAL '5 days'),

  ('30000000-0000-0000-0000-000000000005',
   '10000000-0000-0000-0000-000000000004', '20000000-0000-0000-0000-000000000004',
   87.30, 'pending', NOW() - INTERVAL '1 day', NOW() - INTERVAL '1 day'),

  ('30000000-0000-0000-0000-000000000006',
   '10000000-0000-0000-0000-000000000005', '20000000-0000-0000-0000-000000000001',
   72.80, 'pending', NOW() - INTERVAL '7 days', NOW() - INTERVAL '7 days'),

  ('30000000-0000-0000-0000-000000000007',
   '10000000-0000-0000-0000-000000000006', '20000000-0000-0000-0000-000000000005',
   82.40, 'sent', NOW() - INTERVAL '3 days', NOW() - INTERVAL '2 days'),

  ('30000000-0000-0000-0000-000000000008',
   '10000000-0000-0000-0000-000000000001', '20000000-0000-0000-0000-000000000008',
   68.50, 'pending', NOW() - INTERVAL '2 days', NOW() - INTERVAL '2 days');

-- ============================================
-- OUTREACH (6 outreach records from mock data)
-- ============================================
INSERT INTO outreach (id, match_id, channel, subject, body, status, sent_at, opened_at, clicked_at, replied_at, created_at) VALUES
  ('40000000-0000-0000-0000-000000000001',
   '30000000-0000-0000-0000-000000000001', 'email',
   'New Office Opportunity — New York, NY',
   'Hi Marcus, I have a new Class A office opportunity...',
   'opened', NOW() - INTERVAL '2 days', NOW() - INTERVAL '36 hours', NULL, NULL,
   NOW() - INTERVAL '2 days'),

  ('40000000-0000-0000-0000-000000000002',
   '30000000-0000-0000-0000-000000000002', 'email',
   'New Multifamily Opportunity — Miami, FL',
   'Hi Sarah, luxury waterfront multifamily hitting the market...',
   'replied', NOW() - INTERVAL '5 days', NOW() - INTERVAL '108 hours', NULL, NOW() - INTERVAL '4 days',
   NOW() - INTERVAL '5 days'),

  ('40000000-0000-0000-0000-000000000003',
   '30000000-0000-0000-0000-000000000002', 'sms',
   NULL,
   'Sarah, new 156-unit multifamily in Miami: $28M, 5.1% cap. Reply YES for details.',
   'delivered', NOW() - INTERVAL '5 days', NULL, NULL, NULL,
   NOW() - INTERVAL '5 days'),

  ('40000000-0000-0000-0000-000000000004',
   '30000000-0000-0000-0000-000000000004', 'email',
   'New Industrial Opportunity — Dallas, TX',
   'Hi David, modern distribution warehouse...',
   'replied', NOW() - INTERVAL '10 days', NOW() - INTERVAL '9 days', NOW() - INTERVAL '9 days', NOW() - INTERVAL '8 days',
   NOW() - INTERVAL '10 days'),

  ('40000000-0000-0000-0000-000000000005',
   '30000000-0000-0000-0000-000000000003', 'email',
   'New Multifamily Opportunity — Miami, FL',
   'Hi Robert, luxury waterfront opportunity matching your criteria...',
   'sent', NOW() - INTERVAL '3 days', NULL, NULL, NULL,
   NOW() - INTERVAL '3 days'),

  ('40000000-0000-0000-0000-000000000006',
   '30000000-0000-0000-0000-000000000007', 'email',
   'New Hospitality Opportunity — Miami, FL',
   'Hi Robert, boutique beachfront hotel...',
   'opened', NOW() - INTERVAL '3 days', NOW() - INTERVAL '2 days', NULL, NULL,
   NOW() - INTERVAL '3 days');

-- ============================================
-- NDAs (3 NDA records)
-- ============================================
INSERT INTO ndas (id, buyer_id, lead_id, signer_name, signer_email, signer_company, signed_at, ip_address) VALUES
  ('50000000-0000-0000-0000-000000000001',
   '20000000-0000-0000-0000-000000000003', '10000000-0000-0000-0000-000000000003',
   'David Rodriguez', 'david@lonestarinv.com', 'Lone Star Investments',
   NOW() - INTERVAL '8 days', '192.168.1.100'),

  ('50000000-0000-0000-0000-000000000002',
   '20000000-0000-0000-0000-000000000005', '10000000-0000-0000-0000-000000000002',
   'Robert Thompson', 'robert@thompsonfamily.com', 'Thompson Family Office',
   NOW() - INTERVAL '4 days', '192.168.1.101'),

  ('50000000-0000-0000-0000-000000000003',
   '20000000-0000-0000-0000-000000000001', '10000000-0000-0000-0000-000000000001',
   'Marcus Williams', 'marcus@blackstonecap.com', 'Blackstone Capital Partners',
   NOW() - INTERVAL '1 day', '192.168.1.102');

-- ============================================
-- SUBSCRIPTIONS (1 active subscription for the agent)
-- ============================================
INSERT INTO subscriptions (id, user_id, stripe_customer_id, stripe_subscription_id, status, plan, current_period_start, current_period_end, cancel_at_period_end) VALUES
  ('60000000-0000-0000-0000-000000000001',
   '00000000-0000-0000-0000-000000000002',
   'cus_demo_001', 'sub_demo_001',
   'active', 'pro',
   NOW() - INTERVAL '15 days', NOW() + INTERVAL '15 days',
   false);

-- ============================================
-- PROMO CODES
-- ============================================
INSERT INTO promo_codes (code, discount_percent, max_uses, current_uses, expires_at, active) VALUES
  ('LAUNCH50', 50, 100, 12, NOW() + INTERVAL '90 days', true),
  ('DEMO100', 100, 5, 0, NOW() + INTERVAL '30 days', true);
