SET @recruitment_module_id := (SELECT `id` FROM `ohrm_module` WHERE `name`='recruitment');
INSERT INTO `ohrm_workflow` (`id`, `name`, `label`, `available_to`, `default_available_to`, `group_name`, `group_label`, `module_id`, `order_no`) VALUES
('2', 'recruitment', 'Candidate', 1, NULL, 'candidate', 'Candidate', @recruitment_module_id, 10),
('5', 'vacancy', 'Vacancy', '1', NULL, NULL, NULL, @recruitment_module_id, 5);

INSERT INTO `ohrm_workflow_state_machine`(`workflow`,`state`,`role`,`action`,`resulting_state`, `roles_to_notify`, `priority`)  VALUES
('2','INITIAL','ADMIN','1','APPLICATION INITIATED', 'Candidate', 0),
('2','APPLICATION INITIATED','ADMIN','2','SHORTLISTED', '', 0),
('2','APPLICATION INITIATED','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','APPLICATION INITIATED','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','APPLICATION INITIATED','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','APPLICATION INITIATED','ADMIN','13','TEST', '', 0),
('2','APPLICATION INITIATED','ADMIN','7','JOB OFFERED', '', 0),
('2','APPLICATION INITIATED','ADMIN','9','HIRED', '', 0),
('2','APPLICATION INITIATED','ADMIN','14','PREBOARDING', '', 0),
('2','APPLICATION INITIATED','ADMIN','3','REJECTED', '', 0),
('2','SHORTLISTED','ADMIN','4','INTERVIEW SCHEDULED', 'Interviewer,HiringManager,Subscriber,Candidate', 0),
('2','SHORTLISTED','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','SHORTLISTED','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','SHORTLISTED','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','SHORTLISTED','ADMIN','13','TEST', '', 0),
('2','SHORTLISTED','ADMIN','7','JOB OFFERED', '', 0),
('2','SHORTLISTED','ADMIN','9','HIRED', '', 0),
('2','SHORTLISTED','ADMIN','14','PREBOARDING', '', 0),
('2','SHORTLISTED','ADMIN','3','REJECTED', '', 0),
('2','INTERVIEW SCHEDULED','ADMIN','3','REJECTED', '', 0),
('2','INTERVIEW SCHEDULED','ADMIN','5','INTERVIEW PASSED', 'Interviewer,HiringManager,Subscriber', 0),
('2','INTERVIEW SCHEDULED','ADMIN','6','INTERVIEW FAILED', 'Interviewer,HiringManager,Subscriber', 0),
('2','INTERVIEW PASSED','ADMIN','4','INTERVIEW SCHEDULED', 'Interviewer,HiringManager,Subscriber,Candidate', 0),
('2','INTERVIEW PASSED','ADMIN','7','JOB OFFERED', 'Admin,HiringManager,Subscriber', 0),
('2','INTERVIEW PASSED','ADMIN','3','REJECTED', '', 0),
('2','INTERVIEW FAILED','ADMIN','3','REJECTED', '', 0),
('2','PHONE INTERVIEW','ADMIN','2','SHORTLISTED', '', 0),
('2','PHONE INTERVIEW','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','PHONE INTERVIEW','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','PHONE INTERVIEW','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','PHONE INTERVIEW','ADMIN','13','TEST', '', 0),
('2','PHONE INTERVIEW','ADMIN','7','JOB OFFERED', '', 0),
('2','PHONE INTERVIEW','ADMIN','9','HIRED', '', 0),
('2','PHONE INTERVIEW','ADMIN','14','PREBOARDING', '', 0),
('2','PHONE INTERVIEW','ADMIN','3','REJECTED', '', 0),
('2','PANEL INTERVIEW','ADMIN','2','SHORTLISTED', '', 0),
('2','PANEL INTERVIEW','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','PANEL INTERVIEW','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','PANEL INTERVIEW','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','PANEL INTERVIEW','ADMIN','13','TEST', '', 0),
('2','PANEL INTERVIEW','ADMIN','7','JOB OFFERED', '', 0),
('2','PANEL INTERVIEW','ADMIN','9','HIRED', '', 0),
('2','PANEL INTERVIEW','ADMIN','14','PREBOARDING', '', 0),
('2','PANEL INTERVIEW','ADMIN','3','REJECTED', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','2','SHORTLISTED', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','13','TEST', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','7','JOB OFFERED', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','9','HIRED', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','14','PREBOARDING', '', 0),
('2','ONE-ON-ONE INTERVIEW','ADMIN','3','REJECTED', '', 0),
('2','TEST','ADMIN','2','SHORTLISTED', '', 0),
('2','TEST','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','TEST','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','TEST','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','TEST','ADMIN','13','TEST', '', 0),
('2','TEST','ADMIN','7','JOB OFFERED', '', 0),
('2','TEST','ADMIN','9','HIRED', '', 0),
('2','TEST','ADMIN','14','PREBOARDING', '', 0),
('2','TEST','ADMIN','3','REJECTED', '', 0),
('2','JOB OFFERED','ADMIN','10','PHONE INTERVIEW', '', 0),
('2','JOB OFFERED','ADMIN','11','PANEL INTERVIEW', '', 0),
('2','JOB OFFERED','ADMIN','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','JOB OFFERED','ADMIN','13','TEST', '', 0),
('2','JOB OFFERED','ADMIN','8','OFFER DECLINED', 'Admin,HiringManager,Subscriber', 0),
('2','JOB OFFERED','ADMIN','3','REJECTED', '', 0),
('2','JOB OFFERED','ADMIN','9','HIRED', 'Admin,HiringManager,Subscriber,Candidate', 0),
('2','JOB OFFERED','ADMIN','14','PREBOARDING', '', 0),
('2','OFFER DECLINED','ADMIN','3','REJECTED', '', 0),
('2','HIRED','ADMIN','3','REJECTED', '', 0),
('2','HIRED','ADMIN','14','PREBOARDING', '', 0),
('2','REJECTED','ADMIN','7','JOB OFFERED', '', 0),
('2','REJECTED','ADMIN','9','HIRED', '', 0),
('2','REJECTED','ADMIN','14','PREBOARDING', '', 0),
('2','PREBOARDING','ADMIN','7','JOB OFFERED', '', 0),
('2','PREBOARDING','ADMIN','9','HIRED', '', 0),
('2','PREBOARDING','ADMIN','3','REJECTED', '', 0),
('2','INITIAL','HIRING MANAGER','1','APPLICATION INITIATED', 'Candidate', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','2','SHORTLISTED', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','13','TEST', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','9','HIRED', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','APPLICATION INITIATED','HIRING MANAGER','3','REJECTED', '', 0),
('2','SHORTLISTED','HIRING MANAGER','4','INTERVIEW SCHEDULED', 'Interviewer,HiringManager,Subscriber,Candidate', 0),
('2','SHORTLISTED','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','SHORTLISTED','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','SHORTLISTED','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','SHORTLISTED','HIRING MANAGER','13','TEST', '', 0),
('2','SHORTLISTED','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','SHORTLISTED','HIRING MANAGER','9','HIRED', '', 0),
('2','SHORTLISTED','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','SHORTLISTED','HIRING MANAGER','3','REJECTED', '', 0),
('2','INTERVIEW SCHEDULED','HIRING MANAGER','3','REJECTED', '', 0),
('2','INTERVIEW SCHEDULED','HIRING MANAGER','5','INTERVIEW PASSED', 'Interviewer,HiringManager,Subscriber', 0),
('2','INTERVIEW SCHEDULED','HIRING MANAGER','6','INTERVIEW FAILED', 'Interviewer,HiringManager,Subscriber', 0),
('2','INTERVIEW PASSED','HIRING MANAGER','4','INTERVIEW SCHEDULED', 'Interviewer,HiringManager,Subscriber,Candidate', 0),
('2','INTERVIEW PASSED','HIRING MANAGER','7','JOB OFFERED', 'Admin,HiringManager,Subscriber', 0),
('2','INTERVIEW PASSED','HIRING MANAGER','3','REJECTED', '', 0),
('2','INTERVIEW FAILED','HIRING MANAGER','3','REJECTED', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','2','SHORTLISTED', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','13','TEST', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','9','HIRED', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','PHONE INTERVIEW','HIRING MANAGER','3','REJECTED', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','2','SHORTLISTED', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','13','TEST', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','9','HIRED', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','PANEL INTERVIEW','HIRING MANAGER','3','REJECTED', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','2','SHORTLISTED', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','13','TEST', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','9','HIRED', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','ONE-ON-ONE INTERVIEW','HIRING MANAGER','3','REJECTED', '', 0),
('2','TEST','HIRING MANAGER','2','SHORTLISTED', '', 0),
('2','TEST','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','TEST','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','TEST','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','TEST','HIRING MANAGER','13','TEST', '', 0),
('2','TEST','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','TEST','HIRING MANAGER','9','HIRED', '', 0),
('2','TEST','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','TEST','HIRING MANAGER','3','REJECTED', '', 0),
('2','JOB OFFERED','HIRING MANAGER','10','PHONE INTERVIEW', '', 0),
('2','JOB OFFERED','HIRING MANAGER','11','PANEL INTERVIEW', '', 0),
('2','JOB OFFERED','HIRING MANAGER','12','ONE-ON-ONE INTERVIEW', '', 0),
('2','JOB OFFERED','HIRING MANAGER','13','TEST', '', 0),
('2','JOB OFFERED','HIRING MANAGER','8','OFFER DECLINED', 'Admin,HiringManager,Subscriber', 0),
('2','JOB OFFERED','HIRING MANAGER','3','REJECTED', '', 0),
('2','JOB OFFERED','HIRING MANAGER','9','HIRED', 'Admin,HiringManager,Subscriber,Candidate', 0),
('2','JOB OFFERED','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','OFFER DECLINED','HIRING MANAGER','3','REJECTED', '', 0),
('2','HIRED','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','HIRED','HIRING MANAGER','3','REJECTED', '', 0),
('2','REJECTED','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','REJECTED','HIRING MANAGER','9','HIRED', '', 0),
('2','REJECTED','HIRING MANAGER','14','PREBOARDING', '', 0),
('2','PREBOARDING','HIRING MANAGER','7','JOB OFFERED', '', 0),
('2','PREBOARDING','HIRING MANAGER','9','HIRED', '', 0),
('2','PREBOARDING','HIRING MANAGER','3','REJECTED', '', 0),
('2','APPLICATION INITIATED','SYSTEM','2','SHORTLISTED', '', 0),
('2','APPLICATION INITIATED','SYSTEM','3','REJECTED', '', 0),
('2','SHORTLISTED','SYSTEM','3','REJECTED', '', 0),
('2','INTERVIEW SCHEDULED','INTERVIEWER','5','INTERVIEW PASSED', 'Interviewer,HiringManager,Subscriber', 0),
('2','INTERVIEW SCHEDULED','INTERVIEWER','6','INTERVIEW FAILED', 'Interviewer,HiringManager,Subscriber', 0),
--  vacancy flow
('5', 'INITIAL', 'ADMIN', 'CREATE', 'NEW', '', 0),
('5', 'NEW ', 'ADMIN', 'PUBLISH', 'PUBLISHED', 'Admin,HiringManager,Subscriber', 0),
('5', 'PUBLISHED', 'ADMIN', 'CLOSE', 'CLOSED', 'Admin,HiringManager,Subscriber', 0),
('5', 'PUBLISHED', 'ADMIN', 'UNPUBLISH', 'UNPUBLISHED', 'Admin,HiringManager,Subscriber', 0),
('5', 'UNPUBLISHED', 'ADMIN', 'PUBLISH', 'PUBLISHED','Admin,HiringManager,Subscriber', 0),
('5', 'UNPUBLISHED', 'ADMIN', 'CLOSE', 'CLOSED', 'Admin,HiringManager,Subscriber', 0),
('5', 'CLOSED', 'ADMIN','REOPEN','NEW','', 0),
('5', 'INITIAL', 'Hiring Manager', 'CREATE', 'NEW', '', 0),
('5', 'NEW ', 'Hiring Manager', 'PUBLISH', 'PUBLISHED', 'Admin,HiringManager,Subscriber', 0),
('5', 'PUBLISHED', 'Hiring Manager', 'CLOSE', 'CLOSED', 'Admin,HiringManager,Subscriber', 0),
('5', 'PUBLISHED', 'Hiring Manager', 'UNPUBLISH', 'UNPUBLISHED', 'Admin,HiringManager,Subscriber', 0),
('5', 'UNPUBLISHED', 'Hiring Manager', 'PUBLISH', 'PUBLISHED','Admin,HiringManager,Subscriber', 0),
('5', 'UNPUBLISHED', 'Hiring Manager', 'CLOSE', 'CLOSED', 'Admin,HiringManager,Subscriber', 0),
('5', 'CLOSED', 'Hiring Manager','REOPEN','NEW','', 0);


INSERT INTO `ohrm_workflow_screen`(`workflow_name`, `module`, `action`) VALUES
('vacancy', 'recruitment', 'addJobVacancy');

INSERT INTO `ohrm_job_vacancy_workflow_action`(`name`,`action_text`)  VALUES
('CREATE', 'Create'),
('CLOSE', 'Close'),
('PUBLISH', 'Publish'),
('UNPUBLISH', 'Unpublish'),
('REOPEN', 'Reopen');

INSERT INTO `ohrm_job_vacancy_status`(`status`,`name`, `order`)  VALUES
(-1, 'CLOSED', 4),
(1, 'NEW', 3),
(2, 'PUBLISHED', 1),
(3, 'UNPUBLISHED', 2);