-- 1. 插入测试用户 (密码都是123456的bcrypt哈希)
INSERT INTO users (username, password, role) VALUES 
('admin', '$2a$10$xJwL5v5zP6zE5Jf7QYqZNuYQd9WkZf9XvLd1UcJm3VbK6sN8rLbW', 'admin'),
('inspector1', '$2a$10$xJwL5v5zP6zE5Jf7QYqZNuYQd9WkZf9XvLd1UcJm3VbK6sN8rLbW', 'inspector'),
('clerk1', '$2a$10$xJwL5v5zP6zE5Jf7QYqZNuYQd9WkZf9XvLd1UcJm3VbK6sN8rLbW', 'clerk');

-- 2. 插入监管实体
INSERT INTO supervision_entities (name, type, address, contact_person, contact_phone) VALUES
('宁夏第一农场', 'farm', '宁夏银川市兴庆区农场路1号', '张农场主', '13800138001'),
('银川商贸有限公司', 'business', '宁夏银川市金凤区商业街88号', '李经理', '13900139002'),
('银川市污水处理厂', 'facility', '宁夏银川市西夏区环保路5号', '王厂长', '13700137003'),
('贺兰山养殖基地', 'farm', '宁夏银川市贺兰县养殖区88号', '赵场长', '13500135004'),
('银川食品加工厂', 'business', '宁夏银川市永宁县工业区66号', '钱主管', '13600136005');

-- 3. 插入检查记录
INSERT INTO inspections (entity_id, inspector_id, date, result, notes) VALUES
(1, 2, '2025-09-10', 'passed', '防疫措施完善，卫生达标'),
(2, 2, '2025-09-12', 'failed', '消防设备不齐全，限期整改'),
(3, 2, '2025-09-15', 'pending', '例行检查，报告待提交'),
(4, 2, '2025-09-16', 'passed', '养殖环境良好，符合标准'),
(5, 2, '2025-09-17', 'failed', '卫生条件不达标，需整改');

-- 4. 插入违规记录
INSERT INTO violations (entity_id, inspection_id, type, description, status, penalty) VALUES
(2, 2, '消防安全', '灭火器数量不足，安全通道堵塞', 'reported', 5000.00),
(1, NULL, '环保违规', '废弃物处理不规范', 'processed', 3000.00),
(5, 5, '卫生违规', '操作间发现蟑螂，卫生条件差', 'reported', 8000.00);

-- 5. 插入审批流程
INSERT INTO approval_workflows (name, description, steps, created_by) VALUES
('企业注册审批', '新企业注册审批流程', '[{"name":"资料初审","role":"clerk"},{"name":"现场核查","role":"inspector"},{"name":"最终审批","role":"manager"}]', 1),
('违规处理审批', '违规处罚审批流程', '[{"name":"违规确认","role":"inspector"},{"name":"处罚方案","role":"manager"},{"name":"执行确认","role":"clerk"}]', 1);