-- Converted on 2025-07-20T03:06:31+00:00

INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 91, 'General OHS Site Inspection', 'Routine safety inspection of work areas, signage, and emergency readiness', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 91);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 92, 'Plant & Equipment OHS Inspection', 'Inspection of machinery, maintenance records, guards, and operating safety', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 92);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 93, 'Confined Space Entry Inspection', 'Inspection checklist before confined space entry at tanks or manholes', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 93);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 94, 'Field Work Safety Inspection', 'On-site inspection checklist for pipe repair, excavation, or rural works', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 94);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 95, 'OHS Vehicle Inspection', 'Safety checklist for operational and pool vehicles used by staff', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 95);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 96, 'OHS Inspection Start', 'Choose inspection type and location', 'ohs_inspections', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 96);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 59, 'OHS Incident Classification', 'Select incident type and location', 'ohs_incidents', '[]', 
  NULL, 
  NULL
)
ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 59);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 67, 'Needs & Expectations Assessment', 'Stakeholder needs and expectations', 'ohs_needs_expectations', '[]', 
  NULL, 
  NULL
)
ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 67);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 75, 'Risk Assessment', 'Record assessment administrative info', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 75);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 76, 'Risk Assessment Hazard', 'Identify hazards and controls', 'risk_assessment_hazards', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 76);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 77, 'Risk Assessment PPE', 'Personal protective equipment checklist', 'risk_assessment_ppe', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 77);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 78, 'Risk Assessment Sign-off', 'Record assessment approvals', 'risk_assessment_signoffs', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 78);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 84, 'Risk Assessment Type', 'Manage risk assessment classifications', 'risk_assessment_types', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 84);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 85, 'Water Treatment Plant Risk Assessment', 'Assessment of operational and chemical risks in treatment facilities', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 85);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 86, 'Pipeline & Infrastructure Risk Assessment', 'Evaluation of potential failure points across distribution infrastructure', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 86);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 87, 'Environmental and Climate Risk Assessment', 'Assesses environmental vulnerabilities to water supply and treatment', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 87);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 88, 'Occupational Health & Safety Risk Assessment', 'OHS-focused hazard evaluation in operational areas and fieldwork', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 88);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 89, 'Cybersecurity & SCADA Risk Assessment', 'Review of IT security and SCADA operational risk vulnerabilities', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 89);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 90, 'Community & Stakeholder Risk Assessment', 'Analyzes public-facing risks and reputational threats from service issues', 'risk_assessments', '[]', 
  NULL, 
  NULL
) ON CONFLICT (id) DO NOTHING
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 90);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 38, 'Case Hour', 'Record hours worked on a case', 'case_hours', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 38);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 4, 'OHS Incident', 'Default incident report form', 'ohs_incidents', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 4);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 6, 'Job Safety Analysis', 'Record JSA details', 'ohs_jsas', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 6);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 7, 'OHS Hazard', 'Default hazard report form', 'ohs_hazards', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 7);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 8, 'SCORM Package', 'Upload SCORM content', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 8);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 9, 'Training Path', 'Create a learning path', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 9);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 10, 'Safety Induction', 'Record employee safety inductions', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 10);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 11, 'Employee License', 'Track employee licenses', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 11);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 12, 'Training Requirement', 'Assign mandatory courses per project', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 12);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 29, 'Vehicle Registration', 'Capture fleet vehicle details', 'vehicles', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 29);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 30, 'Trip Log', 'Record vehicle trips with mileage', 'NULL', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 30);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 31, 'Service Type', 'Define maintenance intervals', 'service_types', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 31);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 32, 'User Group', 'Manage user groups and permissions', 'groups', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 32);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 33, 'Group Member', 'Assign users to groups', 'user_group_memberships', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 33);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 34, 'Vehicle Issue Report', 'Report vehicle issues', 'vehicle_reports', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 34);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 35, 'Client', 'Client details', 'clients', '[]', NULL, -- tenant_id
        NULL    -- branch_id
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 35);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 36, 'Case', 'Case record', 'cases', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 36);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 37, 'Lawyer', 'Lawyer user', 'users', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 37);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 39, 'Tenant', 'Tenant details', 'tenants', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 39);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 40, 'Admin', 'Admin user', 'users', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 40);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 41, 'User', 'User account details', 'users', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 41);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 42, 'Vehicle Downtime', 'Record vehicle downtime periods', 'vehicle_downtime', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 42);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 44, 'Invoice Settings', 'Configure invoice defaults', 'invoice_settings', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 44);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 45, 'Driver', 'Driver user', 'users', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 45);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 46, 'Fleet Engineer', 'Fleet engineer user', 'users', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 46);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 47, 'Case Instruction', 'Matter instruction', 'case_instructions', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 47);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 48, 'Case Expense', 'Case related expense', 'expenses', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 48);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 49, 'Case Invoice', 'Invoice for a case', 'invoices', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 49);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 50, 'Case Payment', 'Payment for a case invoice', 'payments', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 50);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 51, 'Case Approval', 'Approve or reject case', NULL, '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 51);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 52, 'OHS Action', 'Action taken for an incident', 'ohs_actions', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 52);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 53, 'OHS Regulation', 'Record safety regulations', 'ohs_regulations', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 53);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 54, 'OHS Compliance Task', 'Task to meet a regulation', 'ohs_compliance_tasks', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 54);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 55, 'Permit Inspection', 'Record permit inspections', 'permit_inspections', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 55);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 56, 'Hazard Type', 'Manage hazard classifications', 'ohs_hazard_types', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 56);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 57, 'Incident Type', 'Manage incident categories', 'ohs_incident_types', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 57);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 58, 'OHS Assignment Rule', 'Investigator assignment rule', 'ohs_assignment_rules', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 58);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 66, 'Issues Log', 'Record safety issues', 'ohs_issues', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 66);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 68, 'Inspection Type', 'Manage inspection categories', 'ohs_inspection_types', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 68);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 72, 'Training Certificate', 'Employee training record', 'training_certificates', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 72);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 79, 'Risk Category', 'Risk classification', 'risk_categories', '[]', NULL, -- tenant_id
        NULL    -- branch_id
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 79);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 82, 'Incident Status', 'Manage incident status options', 'ohs_incident_statuses', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 82);
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id)
SELECT 83, 'Corrective Action', 'Track corrective actions for incidents', 'corrective_actions', '[]', NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM forms WHERE id = 83);
