-- ============================================================
-- The Vibe - Seed Data
-- GTA Zones + Sample Data for Development
-- ============================================================

-- ============================================================
-- GTA ZONES (PostGIS Polygons)
-- ============================================================

INSERT INTO zones (id, name, slug, boundary, center, radius_km, status, priority) VALUES

-- Downtown Toronto (priority 1 - launched first)
(
  uuid_generate_v4(),
  'Downtown Toronto',
  'downtown-toronto',
  ST_GeographyFromText('POLYGON((-79.4200 43.6400, -79.3500 43.6400, -79.3500 43.6700, -79.4200 43.6700, -79.4200 43.6400))'),
  ST_GeographyFromText('POINT(-79.3832 43.6532)'),
  5.0,
  'active',
  10
),

-- Liberty Village
(
  uuid_generate_v4(),
  'Liberty Village',
  'liberty-village',
  ST_GeographyFromText('POLYGON((-79.4300 43.6350, -79.4100 43.6350, -79.4100 43.6450, -79.4300 43.6450, -79.4300 43.6350))'),
  ST_GeographyFromText('POINT(-79.4196 43.6389)'),
  2.0,
  'active',
  9
),

-- North York
(
  uuid_generate_v4(),
  'North York',
  'north-york',
  ST_GeographyFromText('POLYGON((-79.4800 43.7500, -79.3800 43.7500, -79.3800 43.7900, -79.4800 43.7900, -79.4800 43.7500))'),
  ST_GeographyFromText('POINT(-79.4282 43.7615)'),
  6.0,
  'active',
  8
),

-- Scarborough
(
  uuid_generate_v4(),
  'Scarborough',
  'scarborough',
  ST_GeographyFromText('POLYGON((-79.2800 43.7200, -79.1700 43.7200, -79.1700 43.7800, -79.2800 43.7800, -79.2800 43.7200))'),
  ST_GeographyFromText('POINT(-79.2314 43.7568)'),
  8.0,
  'active',
  7
),

-- Mississauga
(
  uuid_generate_v4(),
  'Mississauga',
  'mississauga',
  ST_GeographyFromText('POLYGON((-79.7500 43.5500, -79.5800 43.5500, -79.5800 43.6800, -79.7500 43.6800, -79.7500 43.5500))'),
  ST_GeographyFromText('POINT(-79.6441 43.5890)'),
  12.0,
  'active',
  6
),

-- Etobicoke (coming soon)
(
  uuid_generate_v4(),
  'Etobicoke',
  'etobicoke',
  ST_GeographyFromText('POLYGON((-79.5800 43.6200, -79.4800 43.6200, -79.4800 43.7000, -79.5800 43.7000, -79.5800 43.6200))'),
  ST_GeographyFromText('POINT(-79.5300 43.6580)'),
  7.0,
  'coming_soon',
  5
),

-- East York (coming soon)
(
  uuid_generate_v4(),
  'East York',
  'east-york',
  ST_GeographyFromText('POLYGON((-79.3500 43.6800, -79.2900 43.6800, -79.2900 43.7200, -79.3500 43.7200, -79.3500 43.6800))'),
  ST_GeographyFromText('POINT(-79.3179 43.6967)'),
  4.0,
  'coming_soon',
  4
);

-- ============================================================
-- SAMPLE ADMIN USER
-- ============================================================

-- Password: Admin@123 (bcrypt hash - change in production)
INSERT INTO users (id, email, phone, password_hash, role, first_name, last_name, is_verified, is_active) VALUES
(
  'a0000000-0000-0000-0000-000000000001',
  'admin@thevibe.ca',
  '416-000-0001',
  '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewqmqNF1.4ABCDEF',
  'admin',
  'Platform',
  'Admin',
  TRUE,
  TRUE
);

-- ============================================================
-- SAMPLE RESTAURANTS (Development Only)
-- ============================================================

-- Restaurant owner users
INSERT INTO users (id, email, phone, password_hash, role, first_name, last_name, is_verified) VALUES
('b0000000-0000-0000-0000-000000000001', 'owner@pizzanapoli.ca', '416-555-0101', '$2b$12$placeholder', 'restaurant_owner', 'Marco', 'Rossi', TRUE),
('b0000000-0000-0000-0000-000000000002', 'owner@burgerhaus.ca', '416-555-0102', '$2b$12$placeholder', 'restaurant_owner', 'Hans', 'Mueller', TRUE),
('b0000000-0000-0000-0000-000000000003', 'owner@tokyoramen.ca', '416-555-0103', '$2b$12$placeholder', 'restaurant_owner', 'Yuki', 'Tanaka', TRUE);

-- Sample restaurants in Downtown Toronto
INSERT INTO restaurants (id, owner_id, name, slug, description, cuisine_type, phone, email, address, postal_code, location, zone_id, is_active, is_open, rating) VALUES
(
  'c0000000-0000-0000-0000-000000000001',
  'b0000000-0000-0000-0000-000000000001',
  'Pizza Napoli',
  'pizza-napoli',
  'Authentic Neapolitan pizza made with imported ingredients',
  ARRAY['Italian', 'Pizza'],
  '416-555-0101',
  'hello@pizzanapoli.ca',
  '123 King Street West, Toronto, ON',
  'M5H 1J9',
  ST_GeographyFromText('POINT(-79.3867 43.6481)'),
  (SELECT id FROM zones WHERE slug = 'downtown-toronto'),
  TRUE, TRUE, 4.8
),
(
  'c0000000-0000-0000-0000-000000000002',
  'b0000000-0000-0000-0000-000000000002',
  'Burger Haus',
  'burger-haus',
  'Premium smash burgers made fresh daily',
  ARRAY['American', 'Burgers'],
  '416-555-0102',
  'hello@burgerhaus.ca',
  '456 Queen Street West, Toronto, ON',
  'M5V 2B1',
  ST_GeographyFromText('POINT(-79.4034 43.6487)'),
  (SELECT id FROM zones WHERE slug = 'downtown-toronto'),
  TRUE, TRUE, 4.6
),
(
  'c0000000-0000-0000-0000-000000000003',
  'b0000000-0000-0000-0000-000000000003',
  'Tokyo Ramen House',
  'tokyo-ramen-house',
  'Slow-cooked tonkotsu and shoyu ramen bowls',
  ARRAY['Japanese', 'Ramen'],
  '416-555-0103',
  'hello@tokyoramen.ca',
  '789 Dundas Street West, Toronto, ON',
  'M6J 1V4',
  ST_GeographyFromText('POINT(-79.4134 43.6487)'),
  (SELECT id FROM zones WHERE slug = 'downtown-toronto'),
  TRUE, TRUE, 4.7
);

-- Sample menu categories and items for Pizza Napoli
INSERT INTO menu_categories (id, restaurant_id, name, sort_order) VALUES
('d0000000-0000-0000-0000-000000000001', 'c0000000-0000-0000-0000-000000000001', 'Pizzas', 1),
('d0000000-0000-0000-0000-000000000002', 'c0000000-0000-0000-0000-000000000001', 'Appetizers', 2),
('d0000000-0000-0000-0000-000000000003', 'c0000000-0000-0000-0000-000000000001', 'Drinks', 3);

INSERT INTO menu_items (restaurant_id, category_id, name, description, price, dietary_tags, is_featured) VALUES
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000001', 'Margherita', 'San Marzano tomatoes, fresh mozzarella, basil', 18.00, ARRAY['vegetarian'], TRUE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000001', 'Diavola', 'Spicy salami, tomato, fior di latte', 21.00, ARRAY[]::VARCHAR[], FALSE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000001', 'Quattro Formaggi', 'Mozzarella, gorgonzola, parmesan, ricotta', 23.00, ARRAY['vegetarian'], FALSE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000002', 'Bruschetta', 'Tomato, basil, garlic on grilled bread', 9.00, ARRAY['vegan'], FALSE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000002', 'Arancini', 'Saffron risotto balls, tomato sauce', 11.00, ARRAY['vegetarian'], FALSE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000003', 'San Pellegrino', 'Sparkling water 500ml', 4.00, ARRAY['vegan'], FALSE),
('c0000000-0000-0000-0000-000000000001', 'd0000000-0000-0000-0000-000000000003', 'Italian Soda', 'Aranciata or Limonata', 4.50, ARRAY['vegan'], FALSE);

-- Sample driver user
INSERT INTO users (id, email, phone, password_hash, role, first_name, last_name, is_verified) VALUES
('e0000000-0000-0000-0000-000000000001', 'driver@example.ca', '416-555-0201', '$2b$12$placeholder', 'driver', 'James', 'Driver', TRUE);

INSERT INTO drivers (id, user_id, zone_id, vehicle_type, is_approved, is_background_checked) VALUES
('f0000000-0000-0000-0000-000000000001', 'e0000000-0000-0000-0000-000000000001', (SELECT id FROM zones WHERE slug = 'downtown-toronto'), 'bicycle', TRUE, TRUE);

INSERT INTO driver_locations (driver_id, location, is_online, is_available) VALUES
('f0000000-0000-0000-0000-000000000001', ST_GeographyFromText('POINT(-79.3832 43.6532)'), FALSE, FALSE);

-- Sample customer user
INSERT INTO users (id, email, phone, password_hash, role, first_name, last_name, is_verified) VALUES
('g0000000-0000-0000-0000-000000000001', 'customer@example.ca', '416-555-0301', '$2b$12$placeholder', 'customer', 'Jane', 'Customer', TRUE);
