-- Clean and Seed Raw Materials Table
-- WARNING: This will delete all existing data in m_raw_materials table!
-- Make sure to backup your database before running this script

BEGIN;

-- Step 1: Delete all existing data
TRUNCATE TABLE m_raw_materials RESTART IDENTITY CASCADE;

-- Step 2: Insert new production data
-- Note: Tipe values cleaned (removed parentheses), tipe_doi set to proper values
INSERT INTO m_raw_materials(
    name, code, description, uom, uom_pakai, conversion_factor_utuh_pakai, 
    uom_utuh, conversion_factor_kirim_utuh, uom_kirim, tipe, tipe_doi,
    delete_flag, created_by, updated_by, created_at, updated_at
)
VALUES 
('BAKMI GORENG','FRZ5040','BAKMI GORENG FRZ 8KG','KG','KG',8,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('BAKMI REBUS','FRZ5021','BAKMI REBUS FROZEN 9.1KG','KG','KG',9.1,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('BAKMI MENTAH RTE','FRZ5080','BAKMI MENTAH RETAIL','PR','PA',1,'PA',10,'DS','RM','RTE Frozen',0,1,1,NOW(),NOW()),
('KULIT GORENG','FRZ5036','KULIT GORENG VACUUM7.5KG','KG','KG',7.5,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('KULIT REBUS','FRZ5037','KULIT REBUS VACUUM 2.6KG','KG','KG',2.6,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('PANGSIT KUAH RTE','FRZ5071','PANGSIT RTE NEW','BH','PA',12,'DS',1,'DS','RM','RTE Frozen',0,1,1,NOW(),NOW()),
('YIFUMIE MATANG','DRY1022','YFM CPP','BH','BH',20,'DS',1,'DS','RM','Kering',0,1,1,NOW(),NOW()),
('YIFUMIE MATANG','DRY1009','YI FU MIE 0.045KG','BH','BH',20,'DS',1,'DS','SUB','Kering',0,1,1,NOW(),NOW()),
('YIFUMIE','CHL5063','YIFUMIE FRESH 9.1 KG','KG','KG',9.1,'DS',1,'DS','SUB','Basah',0,1,1,NOW(),NOW()),
('BUMBU KUAH','DRY2057','BUMBU KUAH 0.15KG','KG','PA',10,'KT',1,'KT','RM','Kering',0,1,1,NOW(),NOW()),
('BUMBU MIE','CHL5076','BUMBU MIE NBM 1 LT','LT','LT',1,'PA',6,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('BUMBU MIE','CHL5046','BUMBU MIE 1 LT','LT','LT',1,'PA',6,'DS','SUB','Basah',0,1,1,NOW(),NOW()),
('KUAH AYAM','FRZ5045','KUAH AYAM 0.5LT','LT','LT',0.5,'PA',6,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('KUAH AYAM RTE','FRZ5065','KUAH AYAM RETAIL','LT','PA',1,'PA',1,'PA','RM','RTE Frozen',0,1,1,NOW(),NOW()),
('MINYAK MIE','DRY1008','MINYAK MIE 1 LT','LT','LT',1,'PA',6,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('SAMBAL AYAM GORENG','CHL5095','SAMBAL AYAM GORENG 0.45LT','LT','LT',0.45,'PA',1,'PA','RM','Basah',0,1,1,NOW(),NOW()),
('SAMBAL PEDAS SACHET','DRY0119','SAMBAL PEDAS SCHT 15KG','KG','KG',15,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('SAOS AYAM THAI MIX','CHL5096','SAOS AYAM THAI MIX 0.37KG','KG','KG',0.37,'KT',1,'KT','RM','Basah',0,1,1,NOW(),NOW()),
('SAOS AYAM THAI MIX','CHL5032','SAOS AYAM THAI MIX 0.74KG','KG','KG',0.74,'KT',1,'KT','SUB','Basah',0,1,1,NOW(),NOW()),
('SAOS TIRAM MIX','CHL5089','SAOS TIRAM MIX POUCH 0.25LT','LT','LT',0.25,'PA',1,'PA','RM','Basah',0,1,1,NOW(),NOW()),
('SAOS TOMAT SACHET','DRY2075','SAOS TOMAT SACHET 1KG','KG','KG',1,'KT',1,'KT','RM','Kering',0,1,1,NOW(),NOW()),
('SIOMAY','FRZ5034','SIOMAY FRZ VACUUM 35GR','BH','BH',80,'DS',1,'DS','RM','Basah',0,1,1,NOW(),NOW()),
('SIOMAY','FRZ5047','SIOMAY VACUUM 35GR','BH','BH',80,'DS',1,'DS','SUB','Basah',0,1,1,NOW(),NOW()),
('SIOMAY RTE','FRZ5049','SIOMAY FRZ RETAIL 8BH','BH','PA',6,'DS',1,'DS','RM','RTE Frozen',0,1,1,NOW(),NOW()),
('CABE RAWIT HIJAU','CHL0107','CABE RAWIT HIJAU 0.5KG','KG','KG',0.5,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('CABE RAWIT HIJAU','CHL0020','CABE RAWIT HIJAU','KG','KG',1,'KT',1,'KT','SUB','Sayuran',0,1,1,NOW(),NOW()),
('CABE RAWIT MERAH','CHL0021','CABE RAWIT MERAH','KG','KG',0.1,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('DAUN BAWANG KECIL','CHL0024','DAUN BAWANG KECIL','KG','KG',0.2,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('DAUN JERUK','CHL0075','DAUN JERUK 0.01KG','KG','KG',0.01,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('SELEDRI','CHL0035','SELEDRI','KG','KG',0.2,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('SERAI','CHL0077','SERAI 0.1KG','KG','KG',0.1,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('TAUGE','CHL0048','TAUGE BANGKOK','KG','KG',0.5,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('TIMUN','CHL0037','TIMUN 5KG','KG','KG',5,'KT',1,'KT','RM','Sayuran',0,1,1,NOW(),NOW()),
('TIMUN','CHL0105','TIMUN 1KG','KG','KG',1,'KT',1,'KT','SUB','Sayuran',0,1,1,NOW(),NOW());

-- Add more rows (continuing with the rest of the data)
-- Due to length, I'll create this in chunks

COMMIT;
