-- GNEFSHNG - Seed Data

-- Sizes
INSERT INTO variant_sizes (label, sort_order) VALUES
  ('XS', 1), ('S', 2), ('M', 3), ('L', 4), ('XL', 5), ('XXL', 6), ('One Size', 7);

-- Colors
INSERT INTO variant_colors (label, hex, sort_order) VALUES
  ('Black', '#000000', 1),
  ('White', '#FFFFFF', 2),
  ('Navy', '#001F3F', 3),
  ('Grey', '#808080', 4),
  ('Olive', '#808000', 5),
  ('Sand', '#C2B280', 6);

-- Sample collections
INSERT INTO collections (name, slug, description, is_active) VALUES
  ('Essentials', 'essentials', 'Everyday staples built to last.', true),
  ('Street', 'street', 'Bold cuts for the concrete jungle.', true);

-- Sample products
INSERT INTO products (id, name, slug, description, is_active, featured) VALUES
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'Classic Tee', 'classic-tee', 'Premium cotton crew neck t-shirt. Clean lines, perfect fit.', true, true),
  ('b2c3d4e5-f6a7-8901-bcde-f12345678901', 'Cargo Pants', 'cargo-pants', 'Relaxed fit cargo pants with utility pockets. Built for movement.', true, true),
  ('c3d4e5f6-a7b8-9012-cdef-123456789012', 'Oversized Hoodie', 'oversized-hoodie', 'Heavyweight oversized hoodie. Dropped shoulders, kangaroo pocket.', true, false);

-- Variants for Classic Tee
INSERT INTO product_variants (product_id, sku, size_id, color_id, price_cents, stock_qty) VALUES
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-BLK-S', (SELECT id FROM variant_sizes WHERE label = 'S'), (SELECT id FROM variant_colors WHERE label = 'Black'), 34900, 15),
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-BLK-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'Black'), 34900, 20),
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-BLK-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'Black'), 34900, 12),
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-WHT-S', (SELECT id FROM variant_sizes WHERE label = 'S'), (SELECT id FROM variant_colors WHERE label = 'White'), 34900, 10),
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-WHT-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'White'), 34900, 18),
  ('a1b2c3d4-e5f6-7890-abcd-ef1234567890', 'CT-WHT-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'White'), 34900, 8);

-- Variants for Cargo Pants
INSERT INTO product_variants (product_id, sku, size_id, color_id, price_cents, stock_qty) VALUES
  ('b2c3d4e5-f6a7-8901-bcde-f12345678901', 'CP-OLV-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'Olive'), 69900, 10),
  ('b2c3d4e5-f6a7-8901-bcde-f12345678901', 'CP-OLV-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'Olive'), 69900, 14),
  ('b2c3d4e5-f6a7-8901-bcde-f12345678901', 'CP-SND-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'Sand'), 69900, 7),
  ('b2c3d4e5-f6a7-8901-bcde-f12345678901', 'CP-SND-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'Sand'), 69900, 11);

-- Variants for Oversized Hoodie
INSERT INTO product_variants (product_id, sku, size_id, color_id, price_cents, stock_qty) VALUES
  ('c3d4e5f6-a7b8-9012-cdef-123456789012', 'OH-NVY-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'Navy'), 89900, 6),
  ('c3d4e5f6-a7b8-9012-cdef-123456789012', 'OH-NVY-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'Navy'), 89900, 9),
  ('c3d4e5f6-a7b8-9012-cdef-123456789012', 'OH-GRY-M', (SELECT id FROM variant_sizes WHERE label = 'M'), (SELECT id FROM variant_colors WHERE label = 'Grey'), 89900, 5),
  ('c3d4e5f6-a7b8-9012-cdef-123456789012', 'OH-GRY-L', (SELECT id FROM variant_sizes WHERE label = 'L'), (SELECT id FROM variant_colors WHERE label = 'Grey'), 89900, 8);

-- Assign products to collections
INSERT INTO collection_products (collection_id, product_id) VALUES
  ((SELECT id FROM collections WHERE slug = 'essentials'), 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'),
  ((SELECT id FROM collections WHERE slug = 'essentials'), 'c3d4e5f6-a7b8-9012-cdef-123456789012'),
  ((SELECT id FROM collections WHERE slug = 'street'), 'b2c3d4e5-f6a7-8901-bcde-f12345678901'),
  ((SELECT id FROM collections WHERE slug = 'street'), 'c3d4e5f6-a7b8-9012-cdef-123456789012');

-- Sample drop
INSERT INTO drops (title, slug, content, published_at, is_published) VALUES
  ('Summer Drop 2026', 'summer-drop-2026', 'The wait is over. Our Summer 2026 collection brings heat with lightweight fabrics, bold silhouettes, and colors that pop. Limited quantities. First come, first served.', NOW() + INTERVAL '30 days', true);

-- =============================================
-- FIRST ADMIN USER
-- =============================================
-- After creating a Supabase Auth user, run:
-- INSERT INTO staff_users (auth_user_id, email, name, role)
-- VALUES ('<auth-user-uuid>', 'admin@gnefshng.co.za', 'Admin', 'admin');
