INSERT IGNORE INTO permissions (name, display_name, created_at, updated_at) VALUES
('assessments.view','View Clinical Assessments',NOW(),NOW()),
('assessments.create','Create Clinical Assessments',NOW(),NOW()),
('assessments.edit','Edit Clinical Assessments',NOW(),NOW()),
('assessments.submit','Submit Assessments for Review',NOW(),NOW()),
('assessments.review','Review Submitted Assessments',NOW(),NOW()),
('assessments.approve','Approve Reviewed Assessments',NOW(),NOW());

INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id,p.id FROM roles r CROSS JOIN permissions p
WHERE r.name='SUPER_ADMIN' AND p.name IN ('assessments.view','assessments.create','assessments.edit','assessments.submit','assessments.review','assessments.approve');
INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id,p.id FROM roles r CROSS JOIN permissions p
WHERE r.name='ADMIN' AND p.name IN ('assessments.view','assessments.create','assessments.edit','assessments.review','assessments.approve');
INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id,p.id FROM roles r CROSS JOIN permissions p
WHERE r.name='THERAPIST' AND p.name IN ('assessments.view','assessments.create','assessments.edit','assessments.submit');
