-- Seed Dummy Data for WasSerba
DO $$
DECLARE
    cat_makanan UUID;
    cat_minuman UUID;
    cat_sembako UUID;
    cat_atk UUID;
BEGIN
    -- Insert Categories
    INSERT INTO ws_categories (name, description) VALUES ('Makanan Ringan', 'Snack, biskuit, roti') RETURNING id INTO cat_makanan;
    INSERT INTO ws_categories (name, description) VALUES ('Minuman', 'Air mineral, kopi, teh, susu') RETURNING id INTO cat_minuman;
    INSERT INTO ws_categories (name, description) VALUES ('Sembako', 'Beras, minyak goreng, gula, telur') RETURNING id INTO cat_sembako;
    INSERT INTO ws_categories (name, description) VALUES ('Alat Tulis Kantor', 'Buku, pulpen, pensil, kertas') RETURNING id INTO cat_atk;

    -- Insert Products
    -- Makanan
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_makanan, 'WS-10001', 'Indomie Goreng Reguler', 'Mie instan goreng', 2500, 3000, 100, 20, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_makanan, 'WS-10002', 'Biskuit Roma Kelapa 300g', 'Biskuit kelapa', 9000, 11000, 50, 10, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_makanan, 'WS-10003', 'Taro Snack Seaweed 65g', 'Snack rasa rumput laut', 4500, 5500, 80, 15, true);

    -- Minuman
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_minuman, 'WS-20001', 'Aqua Botol 600ml', 'Air mineral botol sedang', 2500, 3500, 200, 48, true);

    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_minuman, 'WS-20002', 'Teh Pucuk Harum 350ml', 'Teh melati botol', 3000, 4000, 120, 24, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_minuman, 'WS-20003', 'Kopi Kapal Api Mix', 'Kopi seduh sachet (1 renceng)', 10000, 12500, 40, 5, true);

    -- Sembako
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_sembako, 'WS-30001', 'Beras Rojolele 5Kg', 'Beras putih pulen', 60000, 65000, 30, 5, true);

    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_sembako, 'WS-30002', 'Minyak Goreng Bimoli 2L', 'Minyak goreng kemasan', 32000, 36000, 45, 10, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_sembako, 'WS-30003', 'Gula Pasir Gulaku 1Kg', 'Gula tebu murni', 14000, 16000, 60, 15, true);

    -- ATK
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_atk, 'WS-40001', 'Buku Tulis Sinar Dunia 38 Lembar', 'Buku tulis garis', 2500, 3500, 100, 20, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_atk, 'WS-40002', 'Pulpen Standard AE7 Hitam', 'Pulpen tinta hitam', 1500, 2000, 150, 30, true);
    
    INSERT INTO ws_products (category_id, sku, name, description, cost_price, selling_price, stock, min_stock, is_active)
    VALUES (cat_atk, 'WS-40003', 'Kertas HVS A4 70gr (1 Rim)', 'Kertas fotokopi', 45000, 52000, 20, 5, true);

END $$;
