-- Seed common HSN/SAC codes for items and purchase orders
-- Idempotent: upserts on code

INSERT INTO hsn_codes (code, description, is_active)
VALUES
  ('27101990', 'Mineral oils and preparations', TRUE),
  ('28289040', 'Chlorides, bromides and iodides', TRUE),
  ('29051100', 'Methanol (methyl alcohol)', TRUE),
  ('34029099', 'Organic surface-active agents (other)', TRUE),
  ('39011010', 'Polyethylene, specific gravity < 0.94', TRUE),
  ('39201019', 'Plastic plates, sheets, film (other)', TRUE),
  ('39232990', 'Plastic sacks and bags (other)', TRUE),
  ('40103999', 'Transmission belts and V-belts (other)', TRUE),
  ('48191000', 'Cartons, boxes and cases of corrugated paper', TRUE),
  ('72142090', 'Bars and rods of iron or non-alloy steel (other)', TRUE),
  ('73181500', 'Screws and bolts with nuts or washers', TRUE),
  ('73269099', 'Other articles of iron or steel', TRUE),
  ('84148090', 'Air pumps, compressors and fans (parts/other)', TRUE),
  ('84198990', 'Machinery for treatment of materials by temperature (other)', TRUE),
  ('84219900', 'Parts for filtering or purifying machinery', TRUE),
  ('84283300', 'Conveyors (other)', TRUE),
  ('84748000', 'Machinery for crushing, grinding or mixing', TRUE),
  ('84799090', 'Parts of machines of heading 8479', TRUE),
  ('84818090', 'Taps, cocks, valves and similar appliances (other)', TRUE),
  ('85015210', 'AC motors, multi-phase, output <= 750 W', TRUE),
  ('85044090', 'Static converters (other)', TRUE),
  ('85369090', 'Electrical apparatus for switching (other)', TRUE),
  ('85444999', 'Electric conductors, insulated (other)', TRUE),
  ('87089900', 'Parts and accessories of motor vehicles', TRUE),
  ('998719', 'Maintenance and repair services of machinery', TRUE),
  ('998313', 'IT design and development services', TRUE)
ON CONFLICT (code) DO UPDATE
SET
  description = EXCLUDED.description,
  is_active = EXCLUDED.is_active,
  updated_at = NOW();

-- Verify:
-- SELECT COUNT(*) FROM hsn_codes WHERE is_active = TRUE;
-- SELECT id, code, description FROM hsn_codes ORDER BY code;
