-- ============================================================================
-- UPPI MARKETPLACE - DADOS DE EXEMPLO COMPLETOS
-- Todos os fluxos: catalogo, compra, pagamento, fulfillment, fiscal, settlement
-- ============================================================================


INSERT IGNORE INTO sellers (id, user_id, uuid, company_name, trade_name, document_type, document_number, tax_regime, slug, description, commission_rate, status, approved_at, rating_avg, rating_count) VALUES
(1, 100, UUID(), 'Eletromania Comercio LTDA', 'Eletromania', 'CNPJ', '12345678000190', 'simples_nacional', 'eletromania', 'Especialista em eletronicos e gadgets', 0.12, 'approved', NOW(), 4.7, 156),
(2, 101, UUID(), 'Moda Style ME', 'Moda Style', 'CNPJ', '98765432000155', 'simples_nacional', 'moda-style', 'Moda feminina e masculina de qualidade', 0.15, 'approved', NOW(), 4.5, 89),
(3, 102, UUID(), 'Casa e Cia Decoracoes LTDA', 'Casa & Cia', 'CNPJ', '55544433000122', 'lucro_presumido', 'casa-e-cia', 'Tudo para sua casa com estilo', 0.10, 'approved', NOW(), 4.8, 210);

-- ─── MARCAS ───

INSERT IGNORE INTO brands (id, name, slug, is_active) VALUES
(1, 'Samsung', 'samsung', 1),
(2, 'Apple', 'apple', 1),
(3, 'Nike', 'nike', 1),
(4, 'Adidas', 'adidas', 1),
(5, 'Tramontina', 'tramontina', 1);

-- ─── SUBCATEGORIAS ───

INSERT IGNORE INTO categories (id, parent_id, name, slug, level, path, sort_order, is_active) VALUES
(11, 1, 'Smartphones', 'smartphones', 1, 'eletronicos/smartphones', 1, 1),
(12, 1, 'Notebooks', 'notebooks', 1, 'eletronicos/notebooks', 2, 1),
(13, 1, 'Fones de Ouvido', 'fones-de-ouvido', 1, 'eletronicos/fones-de-ouvido', 3, 1),
(21, 2, 'Camisetas', 'camisetas', 1, 'moda/camisetas', 1, 1),
(22, 2, 'Calcas', 'calcas', 1, 'moda/calcas', 2, 1),
(23, 2, 'Tenis', 'tenis', 1, 'moda/tenis', 3, 1),
(31, 3, 'Panelas', 'panelas', 1, 'casa-e-decoracao/panelas', 1, 1),
(32, 3, 'Decoracao', 'decoracao', 1, 'casa-e-decoracao/decoracao', 2, 1);

-- ─── PRODUTOS (15 produtos com dados completos) ───

-- Eletromania (seller 1)
INSERT IGNORE INTO products (id, uuid, seller_id, category_id, brand_id, sku, name, slug, description, short_description, price, compare_at_price, cost_price, weight_kg, width_cm, height_cm, depth_cm, ncm, ean, origin, status, is_active, has_variants, rating_avg, rating_count, sales_count, view_count) VALUES
(1, UUID(), 1, 11, 1, 'SM-S24-256', 'Samsung Galaxy S24 256GB', 'samsung-galaxy-s24-256gb', '<p>O Galaxy S24 chegou com inteligencia artificial integrada. Tela Dynamic AMOLED 2X de 6.2 polegadas, processador Snapdragon 8 Gen 3.</p><ul><li>Camera tripla 50MP</li><li>Bateria 4000mAh</li><li>5G</li></ul>', 'Smartphone Samsung Galaxy S24 com IA integrada', 3999.00, 4499.00, 2800.00, 0.168, 7.1, 14.7, 0.76, '85171231', '7891234567890', '1', 'active', 1, 1, 4.8, 87, 234, 5621),
(2, UUID(), 1, 12, 1, 'NB-BOOK3', 'Samsung Galaxy Book3 Pro 14"', 'samsung-galaxy-book3-pro', '<p>Notebook ultrafino com tela AMOLED 14 polegadas, Intel Core i7 13a geracao, 16GB RAM, 512GB SSD.</p>', 'Notebook Samsung ultrafino com tela AMOLED', 6499.00, 7299.00, 4500.00, 1.17, 31.2, 22.4, 1.15, '84713012', '7891234567891', '1', 'active', 1, 0, 4.6, 45, 89, 3210),
(3, UUID(), 1, 13, 1, 'BUDS-PRO2', 'Samsung Galaxy Buds2 Pro', 'samsung-galaxy-buds2-pro', '<p>Fone bluetooth com cancelamento ativo de ruido, audio Hi-Fi 24bit, resistente a agua IPX7.</p>', 'Fone bluetooth premium com ANC', 899.00, 1199.00, 450.00, 0.058, 5.0, 5.0, 2.2, '85183010', '7891234567892', '0', 'active', 1, 1, 4.5, 123, 456, 8900),
(4, UUID(), 1, 11, 2, 'IPH-15PRO', 'iPhone 15 Pro 256GB', 'iphone-15-pro-256gb', '<p>iPhone 15 Pro com chip A17 Pro, camera de 48MP com sistema de camera pro, Dynamic Island, USB-C.</p>', 'iPhone 15 Pro com chip A17 Pro', 7999.00, 8499.00, 6200.00, 0.187, 7.1, 14.6, 0.83, '85171231', '7891234567893', '1', 'active', 1, 1, 4.9, 156, 567, 12340),
(5, UUID(), 1, 13, 2, 'AIRPODS-PRO2', 'Apple AirPods Pro 2', 'apple-airpods-pro-2', '<p>AirPods Pro com chip H2, cancelamento ativo de ruido 2x melhor, audio adaptativo.</p>', 'AirPods Pro 2a geracao com USB-C', 1899.00, 2199.00, 1200.00, 0.051, 4.5, 6.0, 2.4, '85183010', '7891234567894', '0', 'active', 1, 0, 4.7, 98, 321, 7650);

-- Moda Style (seller 2)
INSERT IGNORE INTO products (id, uuid, seller_id, category_id, brand_id, sku, name, slug, description, short_description, price, compare_at_price, cost_price, weight_kg, width_cm, height_cm, depth_cm, ncm, origin, status, is_active, has_variants, rating_avg, rating_count, sales_count, view_count) VALUES
(6, UUID(), 2, 21, 3, 'NK-DRI-M', 'Camiseta Nike Dri-FIT', 'camiseta-nike-dri-fit', '<p>Camiseta esportiva com tecnologia Dri-FIT que absorve o suor. Ideal para treinos.</p>', 'Camiseta esportiva Nike com tecnologia Dri-FIT', 149.90, 199.90, 60.00, 0.200, 30, 40, 2, '61091000', '0', 'active', 1, 1, 4.3, 67, 890, 4500),
(7, UUID(), 2, 23, 3, 'NK-AIRMAX', 'Tenis Nike Air Max 90', 'tenis-nike-air-max-90', '<p>Icone do streetwear com amortecimento Air Max visivel. Cabedal em couro e malha.</p>', 'Tenis Nike Air Max 90 classico', 699.90, 899.90, 350.00, 0.800, 35, 12, 25, '64041900', '1', 'active', 1, 1, 4.6, 134, 567, 9800),
(8, UUID(), 2, 22, 4, 'AD-CALCA-3S', 'Calca Adidas 3 Stripes', 'calca-adidas-3-stripes', '<p>Calca esportiva classica com 3 listras laterais. Tecido french terry macio.</p>', 'Calca Adidas classica com 3 listras', 249.90, 329.90, 100.00, 0.350, 30, 45, 3, '61034200', '1', 'active', 1, 1, 4.4, 78, 345, 5670),
(9, UUID(), 2, 21, 4, 'AD-CAMISETA-ESS', 'Camiseta Adidas Essentials', 'camiseta-adidas-essentials', '<p>Camiseta basica Adidas em algodao macio com logo bordado no peito.</p>', 'Camiseta Adidas basica em algodao', 119.90, 159.90, 45.00, 0.180, 30, 40, 2, '61091000', '0', 'active', 1, 1, 4.2, 45, 678, 3400),
(10, UUID(), 2, 23, 4, 'AD-ULTRABOOST', 'Tenis Adidas Ultraboost 23', 'tenis-adidas-ultraboost-23', '<p>Tenis de corrida com tecnologia Boost para retorno de energia. Cabedal Primeknit.</p>', 'Tenis Adidas Ultraboost para corrida', 899.90, 1099.90, 450.00, 0.680, 35, 12, 25, '64041900', '1', 'active', 1, 1, 4.8, 89, 234, 7800);

-- Casa & Cia (seller 3)
INSERT IGNORE INTO products (id, uuid, seller_id, category_id, brand_id, sku, name, slug, description, short_description, price, compare_at_price, cost_price, weight_kg, width_cm, height_cm, depth_cm, ncm, origin, status, is_active, has_variants, rating_avg, rating_count, sales_count, view_count) VALUES
(11, UUID(), 3, 31, 5, 'TR-CONJ-5', 'Conjunto de Panelas Tramontina 5 Pecas', 'conjunto-panelas-tramontina-5-pecas', '<p>Conjunto de panelas em aluminio com revestimento antiaderente Starflon. 5 pecas.</p>', 'Jogo de panelas Tramontina antiaderente', 299.90, 399.90, 150.00, 3.500, 40, 25, 40, '73239300', '0', 'active', 1, 0, 4.9, 234, 890, 6700),
(12, UUID(), 3, 31, 5, 'TR-FRIGID', 'Frigideira Tramontina Profissional 28cm', 'frigideira-tramontina-profissional-28cm', '<p>Frigideira profissional em aluminio forjado com revestimento ceramico. Cabo em silicone.</p>', 'Frigideira profissional Tramontina 28cm', 189.90, 249.90, 80.00, 1.200, 30, 6, 50, '73239300', '0', 'active', 1, 0, 4.7, 156, 567, 4500),
(13, UUID(), 3, 32, NULL, 'CC-ALMOF-DEC', 'Kit 4 Almofadas Decorativas 45x45', 'kit-almofadas-decorativas-45x45', '<p>Kit com 4 almofadas decorativas em veludo com enchimento siliconado. Cores: cinza, bege, verde, terracota.</p>', 'Kit 4 almofadas decorativas em veludo', 159.90, 219.90, 60.00, 1.800, 50, 50, 15, '94049010', '0', 'active', 1, 1, 4.4, 67, 345, 5600),
(14, UUID(), 3, 32, NULL, 'CC-LUMINARIA', 'Luminaria de Mesa LED Touch', 'luminaria-mesa-led-touch', '<p>Luminaria de mesa com LED regulavel, 3 temperaturas de cor, controle touch. USB recarregavel.</p>', 'Luminaria LED de mesa com touch e USB', 129.90, 179.90, 45.00, 0.650, 15, 40, 15, '94054090', '1', 'active', 1, 0, 4.6, 89, 234, 3400),
(15, UUID(), 3, 32, 5, 'TR-TALHERES-24', 'Faqueiro Tramontina 24 Pecas Inox', 'faqueiro-tramontina-24-pecas-inox', '<p>Faqueiro completo em aco inox com cabo em polipropileno. 24 pecas para 6 pessoas.</p>', 'Faqueiro Tramontina inox 24 pecas', 89.90, 129.90, 40.00, 1.100, 35, 25, 5, '82152000', '0', 'active', 1, 0, 4.5, 178, 678, 4500);

-- ─── VARIANTES ───

-- Galaxy S24 variantes (cor)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price, weight_kg) VALUES
(1, 1, 'SM-S24-256-BK', 'Preto', 3999.00, 0.168),
(2, 1, 'SM-S24-256-WH', 'Branco', 3999.00, 0.168),
(3, 1, 'SM-S24-256-VL', 'Violeta', 3999.00, 0.168);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(1, 1, 'Cor', 'Preto'), (2, 2, 'Cor', 'Branco'), (3, 3, 'Cor', 'Violeta');

-- iPhone 15 Pro variantes (cor + armazenamento)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price, weight_kg) VALUES
(4, 4, 'IPH-15PRO-256-NT', 'Titanio Natural 256GB', 7999.00, 0.187),
(5, 4, 'IPH-15PRO-256-BK', 'Titanio Preto 256GB', 7999.00, 0.187),
(6, 4, 'IPH-15PRO-512-NT', 'Titanio Natural 512GB', 9499.00, 0.187);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(4, 4, 'Cor', 'Titanio Natural'), (5, 5, 'Cor', 'Titanio Preto'),
(6, 6, 'Cor', 'Titanio Natural'), (7, 6, 'Armazenamento', '512GB');

-- Galaxy Buds2 Pro (cor)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price, weight_kg) VALUES
(7, 3, 'BUDS-PRO2-BK', 'Preto', 899.00, 0.058),
(8, 3, 'BUDS-PRO2-WH', 'Branco', 899.00, 0.058);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(8, 7, 'Cor', 'Preto'), (9, 8, 'Cor', 'Branco');

-- Nike Dri-FIT (tamanho)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price) VALUES
(9, 6, 'NK-DRI-P', 'P', 149.90), (10, 6, 'NK-DRI-M', 'M', 149.90),
(11, 6, 'NK-DRI-G', 'G', 149.90), (12, 6, 'NK-DRI-GG', 'GG', 149.90);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(10, 9, 'Tamanho', 'P'), (11, 10, 'Tamanho', 'M'), (12, 11, 'Tamanho', 'G'), (13, 12, 'Tamanho', 'GG');

-- Nike Air Max 90 (tamanho)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price) VALUES
(13, 7, 'NK-AM90-39', '39', 699.90), (14, 7, 'NK-AM90-41', '41', 699.90),
(15, 7, 'NK-AM90-43', '43', 699.90);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(14, 13, 'Tamanho', '39'), (15, 14, 'Tamanho', '41'), (16, 15, 'Tamanho', '43');

-- Almofadas (cor)
INSERT IGNORE INTO product_variants (id, product_id, sku, name, price) VALUES
(16, 13, 'CC-ALMOF-CZ', 'Cinza', 159.90), (17, 13, 'CC-ALMOF-BG', 'Bege', 159.90),
(18, 13, 'CC-ALMOF-VD', 'Verde', 159.90);

INSERT IGNORE INTO product_variant_options (id, variant_id, option_name, option_value) VALUES
(17, 16, 'Cor', 'Cinza'), (18, 17, 'Cor', 'Bege'), (19, 18, 'Cor', 'Verde');

-- ─── IMAGENS (1-2 por produto) ───

INSERT IGNORE INTO product_images (id, product_id, url, alt_text, sort_order, is_cover) VALUES
(1, 1, '/uploads/products/galaxy-s24.jpg', 'Samsung Galaxy S24', 1, 1),
(2, 2, '/uploads/products/galaxy-book3.jpg', 'Samsung Galaxy Book3 Pro', 1, 1),
(3, 3, '/uploads/products/buds2-pro.jpg', 'Samsung Galaxy Buds2 Pro', 1, 1),
(4, 4, '/uploads/products/iphone-15-pro.jpg', 'iPhone 15 Pro', 1, 1),
(5, 5, '/uploads/products/airpods-pro2.jpg', 'Apple AirPods Pro 2', 1, 1),
(6, 6, '/uploads/products/nike-drifit.jpg', 'Camiseta Nike Dri-FIT', 1, 1),
(7, 7, '/uploads/products/nike-airmax90.jpg', 'Nike Air Max 90', 1, 1),
(8, 8, '/uploads/products/adidas-3stripes.jpg', 'Calca Adidas 3 Stripes', 1, 1),
(9, 9, '/uploads/products/adidas-essentials.jpg', 'Camiseta Adidas Essentials', 1, 1),
(10, 10, '/uploads/products/adidas-ultraboost.jpg', 'Adidas Ultraboost 23', 1, 1),
(11, 11, '/uploads/products/tramontina-panelas.jpg', 'Conjunto Panelas Tramontina', 1, 1),
(12, 12, '/uploads/products/tramontina-frigideira.jpg', 'Frigideira Tramontina', 1, 1),
(13, 13, '/uploads/products/almofadas-decorativas.jpg', 'Almofadas Decorativas', 1, 1),
(14, 14, '/uploads/products/luminaria-led.jpg', 'Luminaria LED', 1, 1),
(15, 15, '/uploads/products/faqueiro-tramontina.jpg', 'Faqueiro Tramontina', 1, 1);

-- ─── ATRIBUTOS ───

INSERT IGNORE INTO product_attributes (id, product_id, attr_name, attr_value, sort_order) VALUES
(1, 1, 'Tela', '6.2" Dynamic AMOLED 2X', 1), (2, 1, 'Processador', 'Snapdragon 8 Gen 3', 2), (3, 1, 'Camera', '50MP + 12MP + 10MP', 3), (4, 1, 'Bateria', '4000mAh', 4),
(5, 4, 'Tela', '6.1" Super Retina XDR', 1), (6, 4, 'Chip', 'A17 Pro', 2), (7, 4, 'Camera', '48MP + 12MP + 12MP', 3),
(8, 7, 'Material', 'Couro + Malha', 1), (9, 7, 'Solado', 'Borracha Air Max', 2),
(10, 11, 'Material', 'Aluminio com Starflon', 1), (11, 11, 'Pecas', '5 panelas com tampa', 2);

-- ─── ESTOQUE (warehouse = 1 = CD-SP-01) ───

INSERT IGNORE INTO wms_stock (id, product_id, variant_id, seller_id, warehouse_id, quantity, reserved, min_quantity) VALUES
(1, 1, 1, 1, 1, 50, 3, 10), (2, 1, 2, 1, 1, 35, 1, 10), (3, 1, 3, 1, 1, 20, 0, 10),
(4, 2, NULL, 1, 1, 25, 2, 5), (5, 3, 7, 1, 1, 100, 5, 20), (6, 3, 8, 1, 1, 80, 3, 20),
(7, 4, 4, 1, 1, 30, 4, 5), (8, 4, 5, 1, 1, 25, 2, 5), (9, 4, 6, 1, 1, 15, 1, 5),
(10, 5, NULL, 1, 1, 60, 0, 15),
(11, 6, 9, 2, 1, 200, 10, 30), (12, 6, 10, 2, 1, 250, 15, 30), (13, 6, 11, 2, 1, 180, 8, 30), (14, 6, 12, 2, 1, 100, 3, 20),
(15, 7, 13, 2, 1, 45, 5, 10), (16, 7, 14, 2, 1, 55, 8, 10), (17, 7, 15, 2, 1, 40, 3, 10),
(18, 8, NULL, 2, 1, 150, 0, 20), (19, 9, NULL, 2, 1, 300, 0, 30), (20, 10, NULL, 2, 1, 35, 5, 10),
(21, 11, NULL, 3, 1, 80, 10, 15), (22, 12, NULL, 3, 1, 120, 5, 20),
(23, 13, 16, 3, 1, 60, 0, 10), (24, 13, 17, 3, 1, 75, 0, 10), (25, 13, 18, 3, 1, 45, 0, 10),
(26, 14, NULL, 3, 1, 90, 3, 15), (27, 15, NULL, 3, 1, 200, 0, 30);

-- ─── ENDERECOS ───

INSERT IGNORE INTO addresses (id, user_id, label, recipient, zipcode, street, number, complement, neighborhood, city, state, is_default, latitude, longitude) VALUES
(1, 200, 'Casa', 'Maria Souza', '01310100', 'Av Paulista', '1000', 'Apto 121', 'Bela Vista', 'Sao Paulo', 'SP', 1, -23.5614, -46.6558),
(2, 201, 'Trabalho', 'Joao Pereira', '20040020', 'Rua do Ouvidor', '50', 'Sala 301', 'Centro', 'Rio de Janeiro', 'RJ', 1, -22.9005, -43.1762),
(3, 202, 'Casa', 'Fernanda Lima', '30130000', 'Rua da Bahia', '1234', NULL, 'Centro', 'Belo Horizonte', 'MG', 1, -19.9208, -43.9378),
(4, 203, 'Casa', 'Pedro Costa', '80010000', 'Rua XV de Novembro', '789', NULL, 'Centro', 'Curitiba', 'PR', 1, -25.4290, -49.2710),
(5, 204, 'Casa', 'Juliana Martins', '90010000', 'Rua dos Andradas', '456', 'Apto 45', 'Centro Historico', 'Porto Alegre', 'RS', 1, -30.0330, -51.2300);

-- ─── PEDIDOS (5 pedidos em diferentes status) ───

-- Pedido 1: Maria compra Galaxy S24 + Buds (DELIVERED)
INSERT IGNORE INTO orders (id, uuid, order_number, user_id, shipping_address_id, subtotal, discount_total, shipping_total, tax_total, grand_total, status, payment_status, fulfillment_status, source, paid_at, shipped_at, delivered_at, created_at) VALUES
(1, UUID(), 'UPP-20260401-00001', 200, 1, 4898.00, 0, 0, 0, 4898.00, 'delivered', 'paid', 'fulfilled', 'web', '2026-04-01 10:30:00', '2026-04-02 14:00:00', '2026-04-04 11:00:00', '2026-04-01 10:00:00');

INSERT IGNORE INTO order_items (id, order_id, seller_id, product_id, variant_id, product_name, sku, quantity, unit_price, subtotal, discount, tax, commission_rate, commission_amount, fulfillment_status) VALUES
(1, 1, 1, 1, 1, 'Samsung Galaxy S24 256GB - Preto', 'SM-S24-256-BK', 1, 3999.00, 3999.00, 0, 0, 0.12, 479.88, 'fulfilled'),
(2, 1, 1, 3, 7, 'Samsung Galaxy Buds2 Pro - Preto', 'BUDS-PRO2-BK', 1, 899.00, 899.00, 0, 0, 0.12, 107.88, 'fulfilled');

INSERT IGNORE INTO order_splits (id, order_id, seller_id, split_number, subtotal, shipping, discount, total, commission_total, seller_net, status, warehouse_id) VALUES
(1, 1, 1, 'SPL-000001-1', 4898.00, 0, 0, 4898.00, 587.76, 4310.24, 'delivered', 1);

INSERT IGNORE INTO order_status_history (order_id, from_status, to_status, changed_by, reason, created_at) VALUES
(1, NULL, 'pending', 200, 'Pedido criado', '2026-04-01 10:00:00'),
(1, 'pending', 'confirmed', NULL, 'Pagamento PIX confirmado', '2026-04-01 10:30:00'),
(1, 'confirmed', 'processing', NULL, 'Splits criados', '2026-04-01 10:31:00'),
(1, 'processing', 'shipped', NULL, 'Enviado', '2026-04-02 14:00:00'),
(1, 'shipped', 'delivered', NULL, 'Entregue', '2026-04-04 11:00:00');

-- Pedido 2: Joao compra Nike Air Max + Camiseta (SHIPPED)
INSERT IGNORE INTO orders (id, uuid, order_number, user_id, shipping_address_id, subtotal, discount_total, shipping_total, tax_total, grand_total, status, payment_status, fulfillment_status, source, paid_at, shipped_at, created_at) VALUES
(2, UUID(), 'UPP-20260402-00002', 201, 2, 849.80, 0, 19.90, 0, 869.70, 'shipped', 'paid', 'fulfilled', 'web', '2026-04-02 15:00:00', '2026-04-03 09:00:00', '2026-04-02 14:30:00');

INSERT IGNORE INTO order_items (id, order_id, seller_id, product_id, variant_id, product_name, sku, quantity, unit_price, subtotal, discount, tax, commission_rate, commission_amount, fulfillment_status) VALUES
(3, 2, 2, 7, 14, 'Tenis Nike Air Max 90 - 41', 'NK-AM90-41', 1, 699.90, 699.90, 0, 0, 0.15, 104.99, 'fulfilled'),
(4, 2, 2, 6, 10, 'Camiseta Nike Dri-FIT - M', 'NK-DRI-M', 1, 149.90, 149.90, 0, 0, 0.15, 22.49, 'fulfilled');

INSERT IGNORE INTO order_splits (id, order_id, seller_id, split_number, subtotal, shipping, discount, total, commission_total, seller_net, status, warehouse_id) VALUES
(2, 2, 2, 'SPL-000002-1', 849.80, 19.90, 0, 869.70, 127.48, 742.22, 'shipped', 1);

-- Pedido 3: Fernanda compra panelas + faqueiro (PROCESSING)
INSERT IGNORE INTO orders (id, uuid, order_number, user_id, shipping_address_id, subtotal, discount_total, shipping_total, tax_total, grand_total, status, payment_status, fulfillment_status, source, paid_at, created_at) VALUES
(3, UUID(), 'UPP-20260403-00003', 202, 3, 389.80, 0, 15.00, 0, 404.80, 'processing', 'paid', 'unfulfilled', 'web', '2026-04-03 09:00:00', '2026-04-03 08:30:00');

INSERT IGNORE INTO order_items (id, order_id, seller_id, product_id, variant_id, product_name, sku, quantity, unit_price, subtotal, discount, tax, commission_rate, commission_amount, fulfillment_status) VALUES
(5, 3, 3, 11, NULL, 'Conjunto Panelas Tramontina 5 Pecas', 'TR-CONJ-5', 1, 299.90, 299.90, 0, 0, 0.10, 29.99, 'unfulfilled'),
(6, 3, 3, 15, NULL, 'Faqueiro Tramontina 24 Pecas', 'TR-TALHERES-24', 1, 89.90, 89.90, 0, 0, 0.10, 8.99, 'unfulfilled');

INSERT IGNORE INTO order_splits (id, order_id, seller_id, split_number, subtotal, shipping, discount, total, commission_total, seller_net, status, warehouse_id) VALUES
(3, 3, 3, 'SPL-000003-1', 389.80, 15.00, 0, 404.80, 38.98, 365.82, 'processing', 1);

-- Pedido 4: Pedro compra iPhone 15 Pro (PENDING - aguardando pagamento)
INSERT IGNORE INTO orders (id, uuid, order_number, user_id, shipping_address_id, subtotal, discount_total, shipping_total, tax_total, grand_total, status, payment_status, fulfillment_status, source, created_at) VALUES
(4, UUID(), 'UPP-20260403-00004', 203, 4, 7999.00, 0, 0, 0, 7999.00, 'pending', 'pending', 'unfulfilled', 'web', '2026-04-03 16:00:00');

INSERT IGNORE INTO order_items (id, order_id, seller_id, product_id, variant_id, product_name, sku, quantity, unit_price, subtotal, discount, tax, commission_rate, commission_amount, fulfillment_status) VALUES
(7, 4, 1, 4, 4, 'iPhone 15 Pro 256GB - Titanio Natural', 'IPH-15PRO-256-NT', 1, 7999.00, 7999.00, 0, 0, 0.12, 959.88, 'unfulfilled');

INSERT IGNORE INTO order_splits (id, order_id, seller_id, split_number, subtotal, shipping, discount, total, commission_total, seller_net, status, warehouse_id) VALUES
(4, 4, 1, 'SPL-000004-1', 7999.00, 0, 0, 7999.00, 959.88, 7039.12, 'pending', 1);

-- Pedido 5: Juliana compra multi-seller: luminaria (Casa&Cia) + Camiseta Adidas (Moda Style)
INSERT IGNORE INTO orders (id, uuid, order_number, user_id, shipping_address_id, subtotal, discount_total, shipping_total, tax_total, grand_total, status, payment_status, fulfillment_status, source, paid_at, created_at) VALUES
(5, UUID(), 'UPP-20260403-00005', 204, 5, 249.80, 0, 25.00, 0, 274.80, 'confirmed', 'paid', 'unfulfilled', 'web', '2026-04-03 18:00:00', '2026-04-03 17:30:00');

INSERT IGNORE INTO order_items (id, order_id, seller_id, product_id, variant_id, product_name, sku, quantity, unit_price, subtotal, discount, tax, commission_rate, commission_amount, fulfillment_status) VALUES
(8, 5, 3, 14, NULL, 'Luminaria de Mesa LED Touch', 'CC-LUMINARIA', 1, 129.90, 129.90, 0, 0, 0.10, 12.99, 'unfulfilled'),
(9, 5, 2, 9, NULL, 'Camiseta Adidas Essentials', 'AD-CAMISETA-ESS', 1, 119.90, 119.90, 0, 0, 0.15, 17.99, 'unfulfilled');

INSERT IGNORE INTO order_splits (id, order_id, seller_id, split_number, subtotal, shipping, discount, total, commission_total, seller_net, status, warehouse_id) VALUES
(5, 5, 3, 'SPL-000005-1', 129.90, 12.50, 0, 142.40, 12.99, 129.41, 'pending', 1),
(6, 5, 2, 'SPL-000005-2', 119.90, 12.50, 0, 132.40, 17.99, 114.41, 'pending', 1);

-- ─── PAGAMENTOS ───

INSERT IGNORE INTO payment_transactions (id, uuid, order_id, gateway, gateway_transaction_id, payment_type, amount, gateway_fee, net_amount, installments, status, pix_qr_code, pix_copy_paste, created_at) VALUES
(1, UUID(), 1, 'mercado_pago', 'MP-PAY-000001', 'pix', 4898.00, 14.69, 4883.31, 1, 'paid', 'data:image/png;base64,...', '00020126580014br.gov.bcb.pix0136uuid-pix-001', '2026-04-01 10:00:00'),
(2, UUID(), 2, 'mercado_pago', 'MP-PAY-000002', 'credit_card', 869.70, 34.79, 834.91, 3, 'paid', NULL, NULL, '2026-04-02 14:30:00'),
(3, UUID(), 3, 'mercado_pago', 'MP-PAY-000003', 'pix', 404.80, 1.21, 403.59, 1, 'paid', 'data:image/png;base64,...', '00020126580014br.gov.bcb.pix0136uuid-pix-003', '2026-04-03 08:30:00'),
(4, UUID(), 4, 'mercado_pago', 'MP-PAY-000004', 'pix', 7999.00, 0, 7999.00, 1, 'pending', 'data:image/png;base64,...', '00020126580014br.gov.bcb.pix0136uuid-pix-004', '2026-04-03 16:00:00'),
(5, UUID(), 5, 'getnet', 'GN-PAY-000005', 'credit_card', 274.80, 10.99, 263.81, 2, 'paid', NULL, NULL, '2026-04-03 17:30:00');

-- ─── PAYMENT SPLITS ───

INSERT IGNORE INTO payment_splits (id, transaction_id, seller_id, order_split_id, gross_amount, marketplace_fee, gateway_fee, net_amount, status) VALUES
(1, 1, 1, 1, 4898.00, 587.76, 14.69, 4295.55, 'pending'),
(2, 2, 2, 2, 869.70, 127.48, 34.79, 707.43, 'pending'),
(3, 3, 3, 3, 404.80, 38.98, 1.21, 364.61, 'pending'),
(4, 5, 3, 5, 142.40, 12.99, 5.50, 123.91, 'pending'),
(5, 5, 2, 6, 132.40, 17.99, 5.49, 108.92, 'pending');

-- ─── AVALIACOES ───

INSERT IGNORE INTO reviews (id, product_id, user_id, order_item_id, rating, title, comment, is_verified, is_approved, seller_reply, seller_reply_at, created_at) VALUES
(1, 1, 200, 1, 5, 'Excelente smartphone!', 'O Galaxy S24 superou minhas expectativas. A camera e incrivel e a bateria dura o dia todo. IA do Galaxy e um diferencial.', 1, 1, 'Obrigado Maria! Ficamos felizes com sua satisfacao!', '2026-04-05 10:00:00', '2026-04-05 08:00:00'),
(2, 3, 200, 2, 4, 'Muito bom, mas poderia melhor', 'Som excelente e cancelamento de ruido muito bom. Tirei uma estrela porque o estojo poderia ser menor.', 1, 1, NULL, NULL, '2026-04-05 08:30:00'),
(3, 7, 201, 3, 5, 'Tenis perfeito!', 'Confortabilissimo! Use o dia todo sem cansar. Entrega rapida tambem.', 1, 1, 'Joao, que otimo! O Air Max 90 e realmente um classico!', '2026-04-04 15:00:00', '2026-04-04 10:00:00'),
(4, 6, 201, 4, 4, 'Boa camiseta', 'Tecido de qualidade, seca rapido no treino. Tamanho M ficou certinho.', 1, 1, NULL, NULL, '2026-04-04 10:30:00');

-- ─── CUPONS ───

INSERT IGNORE INTO coupons (id, code, description, discount_type, discount_value, min_order_value, max_discount, usage_limit, usage_per_user, starts_at, expires_at, is_active) VALUES
(1, 'BEMVINDO10', 'Desconto de boas vindas 10%', 'percentage', 10.00, 100.00, 50.00, 1000, 1, '2026-01-01', '2026-12-31', 1),
(2, 'FRETEGRATIS', 'Frete gratis em compras acima de R$150', 'free_shipping', 0, 150.00, NULL, 500, 2, '2026-01-01', '2026-06-30', 1),
(3, 'TECH20', 'R$20 off em eletronicos', 'fixed', 20.00, 200.00, NULL, 200, 1, '2026-04-01', '2026-04-30', 1);

-- ─── CONTAS FINANCEIRAS ───

INSERT IGNORE INTO finance_accounts (id, uuid, owner_type, owner_id, account_type, name, balance, blocked_balance) VALUES
(1, UUID(), 'marketplace', 0, 'escrow', 'Marketplace Escrow', 15446.30, 0),
(2, UUID(), 'marketplace', 0, 'commission', 'Marketplace Comissao', 785.20, 0),
(3, UUID(), 'seller', 1, 'receivable', 'Eletromania Receber', 4310.24, 0),
(4, UUID(), 'seller', 1, 'wallet', 'Eletromania Carteira', 0, 0),
(5, UUID(), 'seller', 2, 'receivable', 'Moda Style Receber', 856.63, 0),
(6, UUID(), 'seller', 2, 'wallet', 'Moda Style Carteira', 0, 0),
(7, UUID(), 'seller', 3, 'receivable', 'Casa e Cia Receber', 494.23, 0),
(8, UUID(), 'seller', 3, 'wallet', 'Casa e Cia Carteira', 0, 0);

-- ─── NOTIFICACOES ───

INSERT IGNORE INTO notifications (id, user_id, channel, type, title, body, action_url, created_at) VALUES
(1, 200, 'app', 'order_confirmed', 'Pedido confirmado!', 'Seu pedido UPP-20260401-00001 foi confirmado e esta sendo preparado.', '/pedidos', '2026-04-01 10:30:00'),
(2, 200, 'app', 'shipment_shipped', 'Pedido enviado!', 'Seu pedido UPP-20260401-00001 foi despachado.', '/pedidos', '2026-04-02 14:00:00'),
(3, 200, 'app', 'shipment_delivered', 'Pedido entregue!', 'Seu pedido UPP-20260401-00001 foi entregue com sucesso.', '/pedidos', '2026-04-04 11:00:00'),
(4, 201, 'app', 'order_confirmed', 'Pedido confirmado!', 'Seu pedido UPP-20260402-00002 foi confirmado.', '/pedidos', '2026-04-02 15:00:00'),
(5, 100, 'app', 'new_order', 'Novo pedido!', 'Voce recebeu um novo pedido SPL-000001-1 no valor de R$ 4.898,00.', '/seller/pedidos', '2026-04-01 10:31:00');

-- ─── SHIPMENTS ───

INSERT IGNORE INTO shipments (id, uuid, shipment_number, order_split_id, warehouse_id, carrier_id, tracking_code, tracking_url, weight_kg, declared_value, shipping_cost, status, shipped_at, delivered_at, created_at) VALUES
(1, UUID(), 'SHP-000001', 1, 1, 1, 'BR123456789BR', 'https://rastreamento.correios.com.br/BR123456789BR', 0.226, 4898.00, 0, 'delivered', '2026-04-02 14:00:00', '2026-04-04 11:00:00', '2026-04-02 10:00:00'),
(2, UUID(), 'SHP-000002', 2, 1, 1, 'BR987654321BR', 'https://rastreamento.correios.com.br/BR987654321BR', 1.000, 869.70, 19.90, 'in_transit', '2026-04-03 09:00:00', NULL, '2026-04-03 08:00:00');

INSERT IGNORE INTO shipment_tracking (id, shipment_id, status, description, location, occurred_at) VALUES
(1, 1, 'posted', 'Objeto postado', 'Sao Paulo/SP', '2026-04-02 14:00:00'),
(2, 1, 'in_transit', 'Em transito para destino', 'Barueri/SP', '2026-04-03 06:00:00'),
(3, 1, 'out_for_delivery', 'Saiu para entrega', 'Sao Paulo/SP', '2026-04-04 08:00:00'),
(4, 1, 'delivered', 'Entregue ao destinatario', 'Sao Paulo/SP', '2026-04-04 11:00:00'),
(5, 2, 'posted', 'Objeto postado', 'Sao Paulo/SP', '2026-04-03 09:00:00'),
(6, 2, 'in_transit', 'Em transito', 'Resende/RJ', '2026-04-03 22:00:00');

-- ─── WISHLISTS ───

INSERT IGNORE INTO wishlists (id, user_id, product_id, created_at) VALUES
(1, 200, 4, NOW()), (2, 200, 10, NOW()), (3, 201, 1, NOW()), (4, 202, 7, NOW());

-- ─── CONVERSAS ───

INSERT IGNORE INTO conversations (id, buyer_id, seller_id, order_id, subject, status, last_message_at, created_at) VALUES
(1, 200, 1, 1, 'Duvida sobre garantia Galaxy S24', 'open', '2026-04-05 10:30:00', '2026-04-05 09:00:00');

INSERT IGNORE INTO messages (id, conversation_id, sender_id, body, created_at) VALUES
(1, 1, 200, 'Ola! Gostaria de saber sobre a garantia do Galaxy S24. Ela e internacional?', '2026-04-05 09:00:00'),
(2, 1, 100, 'Ola Maria! A garantia e de 1 ano pela Samsung Brasil. Qualquer problema, pode nos procurar!', '2026-04-05 10:30:00');

