-- =====================================================================
-- SEED DATA CONTOH — Produk, Bahan Baku, Meja, Modifier
-- Jalankan file ini SETELAH schema.sql (aman dijalankan di database yang sudah ada).
-- Tujuan: supaya begitu login pertama kali, langsung terlihat menu, meja,
-- dan bahan baku contoh — bukan tampilan kosong.
-- =====================================================================

-- ---------- SUPPLIER ----------
INSERT INTO suppliers (name, contact_person, phone, address) VALUES
('Supplier Kopi Nusantara', 'Budi Santoso', '081234567890', 'Jl. Kopi Raya No. 10, Mojokerto'),
('Toko Bahan Kue Sejahtera', 'Siti Aminah', '081298765432', 'Jl. Pasar Baru No. 5, Mojokerto');

-- ---------- BAHAN BAKU (INGREDIENTS) ----------
-- unit_id: 1=gr, 2=kg, 3=ml, 4=liter, 5=pcs, 6=shot
INSERT INTO ingredients (name, unit_id, stock_qty, min_stock_qty, cost_per_unit, supplier_id) VALUES
('Biji Kopi Arabica', 1, 5000, 500, 250, 1),
('Susu UHT Full Cream', 3, 10000, 2000, 15, 1),
('Sirup Vanilla', 3, 2000, 300, 80, 1),
('Sirup Karamel', 3, 2000, 300, 80, 1),
('Bubuk Matcha', 1, 1000, 150, 400, 2),
('Bubuk Coklat', 1, 2000, 300, 150, 2),
('Cup Plastik 12oz', 5, 500, 100, 800, 2),
('Cup Plastik 16oz', 5, 500, 100, 900, 2),
('Lid Cup', 5, 1000, 150, 300, 2),
('Sedotan', 5, 1000, 150, 100, 2),
('Es Batu', 2, 50, 10, 3000, 2),
('Tepung Terigu', 1, 5000, 1000, 12, 2),
('Beras', 2, 30, 5, 12000, 2),
('Ayam Fillet', 1, 5000, 1000, 45, 2),
('Kentang Beku', 1, 3000, 500, 30, 2);

-- ---------- MEJA TAMBAHAN (floor_areas Indoor=1, Outdoor=2 sudah ada dari schema.sql) ----------
INSERT INTO tables_master (floor_area_id, code, capacity, pos_x, pos_y, shape) VALUES
(1, 'A1', 2, 20, 20, 'square'),
(1, 'A2', 2, 120, 20, 'square'),
(1, 'A3', 4, 20, 120, 'square'),
(1, 'A4', 4, 120, 120, 'square'),
(1, 'VIP-1', 6, 220, 20, 'rect'),
(2, 'B1', 4, 20, 20, 'round'),
(2, 'B2', 4, 120, 20, 'round'),
(2, 'B3', 2, 220, 20, 'round');

-- ---------- MODIFIER GROUPS & OPTIONS ----------
INSERT INTO modifier_groups (name, is_required, max_select) VALUES
('Temperature', 1, 1),
('Sugar Level', 0, 1),
('Ice Level', 0, 1),
('Extra Shot', 0, 2);

-- Temperature options (group id 1)
INSERT INTO modifier_options (modifier_group_id, name, price_delta, sort_order) VALUES
(1, 'Hot', 0, 1),
(1, 'Ice', 3000, 2);

-- Sugar Level options (group id 2)
INSERT INTO modifier_options (modifier_group_id, name, price_delta, sort_order) VALUES
(2, 'Normal Sugar', 0, 1),
(2, 'Less Sugar (50%)', 0, 2),
(2, 'No Sugar', 0, 3);

-- Ice Level options (group id 3)
INSERT INTO modifier_options (modifier_group_id, name, price_delta, sort_order) VALUES
(3, 'Normal Ice', 0, 1),
(3, 'Less Ice', 0, 2),
(3, 'No Ice', 0, 3);

-- Extra Shot options (group id 4) — konsumsi tambahan Biji Kopi Arabica (ingredient_id=1)
INSERT INTO modifier_options (modifier_group_id, name, price_delta, extra_ingredient_id, extra_ingredient_qty, sort_order) VALUES
(4, 'Extra Shot Espresso', 5000, 1, 18, 1);

-- ---------- PRODUK (menyesuaikan kategori dari schema.sql: 1=Coffee,2=Non-Coffee,3=Pastry,4=Makanan Berat,5=Snack) ----------
INSERT INTO products (category_id, name, price, is_favorite, track_stock) VALUES
(1, 'Iced Latte', 25000, 1, 1),
(1, 'Cappuccino', 23000, 1, 1),
(1, 'Americano', 20000, 0, 1),
(1, 'Caramel Macchiato', 27000, 1, 1),
(2, 'Matcha Latte', 26000, 0, 1),
(2, 'Chocolate', 22000, 0, 1),
(3, 'Croissant Butter', 18000, 0, 0),
(3, 'Muffin Coklat', 15000, 0, 0),
(4, 'Nasi Goreng Spesial', 28000, 1, 1),
(4, 'Ayam Geprek Sambal Matah', 26000, 0, 1),
(5, 'French Fries', 15000, 0, 1),
(5, 'Pisang Goreng Keju', 13000, 0, 0);

-- ---------- RESEP BAHAN BAKU (ingredient-level recipe) ----------
-- Iced Latte (product_id=1): kopi, susu, cup 16oz, lid, sedotan, es batu
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(1, 1, 18), (1, 2, 120), (1, 8, 1), (1, 9, 1), (1, 10, 1), (1, 11, 0.2);

-- Cappuccino (product_id=2): kopi, susu, cup 12oz, lid
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(2, 1, 18), (2, 2, 90), (2, 7, 1), (2, 9, 1);

-- Americano (product_id=3): kopi, cup 12oz, lid
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(3, 1, 18), (3, 7, 1), (3, 9, 1);

-- Caramel Macchiato (product_id=4): kopi, susu, sirup karamel, cup 16oz, lid, sedotan
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(4, 1, 18), (4, 2, 100), (4, 4, 20), (4, 8, 1), (4, 9, 1), (4, 10, 1);

-- Matcha Latte (product_id=5): matcha, susu, cup 16oz, lid, sedotan
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(5, 5, 15), (5, 2, 120), (5, 8, 1), (5, 9, 1), (5, 10, 1);

-- Chocolate (product_id=6): bubuk coklat, susu, cup 16oz, lid, sedotan
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(6, 6, 20), (6, 2, 120), (6, 8, 1), (6, 9, 1), (6, 10, 1);

-- Nasi Goreng Spesial (product_id=9): beras, ayam
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(9, 13, 0.2), (9, 14, 100);

-- Ayam Geprek Sambal Matah (product_id=10): ayam
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(10, 14, 150);

-- French Fries (product_id=11): kentang beku
INSERT INTO product_recipes (product_id, ingredient_id, qty_used) VALUES
(11, 15, 150);

-- ---------- HUBUNGKAN MODIFIER KE PRODUK MINUMAN KOPI ----------
INSERT INTO product_modifier_groups (product_id, modifier_group_id) VALUES
(1,1),(1,2),(1,3),(1,4),   -- Iced Latte
(2,1),(2,2),(2,4),          -- Cappuccino
(3,1),(3,2),(3,4),          -- Americano
(4,1),(4,2),(4,3),(4,4),    -- Caramel Macchiato
(5,1),(5,2),(5,3),          -- Matcha Latte
(6,1),(6,2),(6,3);          -- Chocolate
