-- =====================================================================
-- 샘플 시드 데이터 (데모/초기 셋업용)
-- =====================================================================
SET NAMES utf8mb4;

-- 제품
INSERT INTO cq_product (product_code, product_name, category) VALUES
('PRD001', '수분진정 토너',   '스킨'),
('PRD002', '보습 영양크림',   '크림'),
('PRD003', '브라이트닝 에센스','에센스')
ON DUPLICATE KEY UPDATE product_name=VALUES(product_name);

-- 원료
INSERT INTO cq_material (material_code, material_name, material_grp) VALUES
('M001','정제수',          '기제'),
('M002','글리세린',        '보습제'),
('M003','부틸렌글라이콜',  '보습제'),
('M004','카보머',          '점증제'),
('M005','트리에탄올아민',  '중화제'),
('M006','세틸알코올',      '유화제'),
('M007','히알루론산',      '보습제'),
('M008','나이아신아마이드','기능성'),
('M009','페녹시에탄올',    '방부제'),
('M010','향료',            '첨가제')
ON DUPLICATE KEY UPDATE material_name=VALUES(material_name);

-- 표준 배합 (PRD001 토너 예시, 합계 100%)
INSERT INTO cq_formula (product_code, formula_ver, material_code, std_ratio, tolerance_pct) VALUES
('PRD001','V1','M001',82.0000,1.0),
('PRD001','V1','M002', 5.0000,3.0),
('PRD001','V1','M003', 4.0000,3.0),
('PRD001','V1','M004', 0.3000,5.0),
('PRD001','V1','M005', 0.3000,5.0),
('PRD001','V1','M007', 2.0000,4.0),
('PRD001','V1','M008', 5.0000,2.0),
('PRD001','V1','M009', 1.0000,2.0),
('PRD001','V1','M010', 0.4000,5.0);

-- 품질 관리 기준 (PRD001)
INSERT INTO cq_spec (product_code, prop_name, spec_low, spec_high, spec_target) VALUES
('PRD001','ph',            5.50,  7.00,  6.20),
('PRD001','hardness',      0.00, 20.00,  8.00),
('PRD001','specific_grav', 1.0000,1.0500,1.0200),
('PRD001','content_pct',  95.000,105.000,100.000),
('PRD001','viscosity',  1000.00,3000.00,2000.00)
ON DUPLICATE KEY UPDATE spec_low=VALUES(spec_low), spec_high=VALUES(spec_high);
