--  Adding 10 currency types

INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (1, 'AUD', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (2, 'CAD', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (3, 'CHF', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (4, 'CNY', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (5, 'EUR', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (6, 'GBP', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (7, 'HKD', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (8, 'JPY', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (9, 'NZD', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (10, 'PHP', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (11, 'SGD', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (12, 'THB', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (13, 'TRL', 1);
INSERT INTO ohrm_claim_currency (id, currency_id, active) VALUES (14, 'USD', 1);




INSERT INTO `ohrm_claim_employee_eligibility_criteria_filter` (`id`, `name`, `widget_class`, `validator_class`, `processor_class`, `active`)
VALUES
  (1, 'Job Title', 'JobTitleSelectionWidget', 'JobTitleSelectionValidator', 'JobTitleSelectionProcessor', 1),
  (2, 'Job Categories', 'JobCategoriesSelectionWidget', 'JobCategoriesSelectionValidator',
   'JobCategoriesSelectionProcessor', 1),
  (3, 'Employment Status', 'EmploymentStatusSelectionWidget', 'EmploymentStatusSelectionValidator',
   'EmploymentStatusSelectionProcessor', 1),
  (4, 'Gender', 'GenderSelectionWidget', 'GenderSelectionValidator', 'GenderSelectionProcessor', 1),
  (5, 'Location', 'LocationSelectionWidget', 'LocationSelectionValidator', 'LocationSelectionProcessor', 1),
  (6, 'Service Period', 'ServicePeriodSelectionWidget', 'ServicePeriodSelectionValidator',
   'ServicePeriodSelectionProcessor', 1),
  (7, 'Custom Fields', 'CustomFieldsSelectionWidget', 'CustomFieldsSelectionValidator',
   'CustomFieldsSelectionProcessor', 1);


INSERT INTO `ohrm_claim_expense_type_restriction_filter` (`id`, `class`, `eligibility`, `active`, `widget`, `validator`, `description`)
VALUES
  (1, 'AttachmentRequiredFilter', '', 1, '', '', 'Attachment is mandatory');

-- original data generated by the task
INSERT INTO `ohrm_claim_expense_type_group` (`name`, `deleted`, `form_class`) VALUES
  ('Airfare', 0, 'AirfareForm');
INSERT INTO `ohrm_claim_expense_type_group` (`name`, `deleted`, `form_class`) VALUES
  ('Meals', 0, 'MealsForm');
INSERT INTO `ohrm_claim_expense_type_group` (`name`, `deleted`, `form_class`) VALUES
  ('Transportation', 0, 'TransportationForm');
INSERT INTO `ohrm_claim_expense_type_group` (`name`, `deleted`, `form_class`) VALUES
  ('Other', 0, 'OtherExpenseForm');
  INSERT INTO `ohrm_claim_expense_type_group` (`name`, `deleted`, `form_class`) VALUES
  ('Hotel', 0, 'HotelForm');

SET @max_position := (SELECT MAX(`position`)
                      FROM `ohrm_event_listener`);

INSERT INTO `ohrm_event_listener` (`event`, `listener_class`, `enabled`, `position`) VALUES
  ('expense.expense_type.save', 'ExpenseTypeWorkFlowCreator', 0, @max_position + 1);

INSERT INTO `ohrm_event_listener` (`event`, `listener_class`, `enabled`, `position`) VALUES
  ('expense.estimation_request.save', 'EstimateRequestHistoryListener', 1, @max_position + 2);

INSERT INTO `ohrm_event_listener` (`event`, `listener_class`, `enabled`, `position`) VALUES
  ('expense.expense_claim.save', 'ClaimRequestSaveListener', 1, @max_position + 3),
  ('expense.expense.save', 'ExpenseSaveListener', 1, @max_position + 4),
  ('expense.expense.delete', 'ExpenseDeleteListener', 1, @max_position + 5),
  ('expense.expense_claim.status', 'ClaimRequestStatusChangeListener', 1, @max_position + 6),
  ('expense.apply_estimate', 'EstimateApplyListener', 1, @max_position + 7),
  ('expense.estimation_request.save', 'EstimateApplyListener', 1, @max_position + 8),
  ('expense.expense_claim.status', 'ClaimRequestStatusChangeMailListener', 1, @max_position + 9);


-- INSERT INTO `ohrm_workflow` (`id`, `name`, `label`, `available_to`, `default_available_to`, `group_name`, `group_label`, `order_no`)
-- VALUES ('EXPENSE_TYPE', 'Expense Type', 'Expense Claim - Expense Level', '1,3', '2', 'EXPENSE_TYPE',
--         'Expense Claim - Expense Level', '13');
-- 
-- INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `priority`)
-- VALUES
--   ('EXPENSE_TYPE', 'DRAFT', 'ESS USER', 'Submit', 'SUBMITTED', '', 0),
--   ('EXPENSE_TYPE', 'REJECTED', 'ESS USER', 'Submit', 'SUBMITTED', '', 0),
--   ('EXPENSE_TYPE', 'SUBMITTED', 'ADMIN', 'Approve', 'APPROVED', '', 0),
--   ('EXPENSE_TYPE', 'SUBMITTED', 'ADMIN', 'Reject', 'REJECTED', '', 0),
--   ('EXPENSE_TYPE', 'SUBMITTED', 'SUPERVISOR', 'Approve', 'APPROVED', '', 0),
--   ('EXPENSE_TYPE', 'SUBMITTED', 'SUPERVISOR', 'Reject', 'REJECTED', '', 0);

INSERT INTO `ohrm_claim_expense_paid_by` (`name_of_expense_paid_by`, `is_used_calculate_sum`)
VALUES ('Staff', '1'), ('Company', '1');


INSERT INTO `ohrm_claim_claiming_option` (`id`, `name`, `label`, `bridge_class`, `active`) VALUES
  (NULL, 'general', 'General', 'GeneralClaimRequest', '1'),
  (NULL, 'estimation', 'Approved Travel Requests', 'EstimationBasedClaimRequest', '1'),
  (NULL, 'budget', 'Allocated Budget', 'BudgetBasedClaimRequest', '0'),
  (NULL, 'projects', 'Projects', 'ProjectBasedClaimRequest', '1');


INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.estimate_id_generator', 'EstimateRequestIdGenerator');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_general_id_generator', 'GeneralClaimRequestIdGenerator');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_estimation_id_generator', 'EstimateClaimRequestIdGenerator');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_project_id_generator', 'ProjectClaimRequestIdGenerator');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_request_init_status', 'DRAFT');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.estimate_request_init_status', 'DRAFT');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_init_status', 'DRAFT');

-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_workflow_available', 'no');
-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_request_process_class', 'ClaimRequestProcessor');
-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_type_custom_eligibility', 'yes');
-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_type_budget_applicable', 'no');
-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_type_multi_currency_applicable', 'yes');
-- yes / no
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.expense_type_restrictions_applicable', 'yes');
-- comma seperated status.
INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.estimate_request_eligible_status', 'APPROVED');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.claim_submit_action', 'Submit');

INSERT INTO `ohrm_config` (`property`, `value`)
VALUES ('expense.estimate_submit_action', 'Submit');

INSERT INTO `ohrm_workflow` (`id`, `name`, `label`, `available_to`, `default_available_to`, `group_name`, `group_label`, `order_no`)
VALUES ('CLAIM_REQUEST', 'Claim Request', 'Expense Claim', '1,3', '2', NULL, NULL, '12');

INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`)
VALUES
  ('CLAIM_REQUEST', 'INITIAL', 'ESS USER', 'Create', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'INITIAL', 'SUPERVISOR', 'Create', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'INITIAL', 'ADMIN', 'Create', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ESS USER', 'Delete', 'DELETED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'SUPERVISOR', 'Delete', 'DELETED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ADMIN', 'Delete', 'DELETED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ESS USER', 'Update', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'SUPERVISOR', 'Update', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ADMIN', 'Update', 'DRAFT', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ESS USER', 'Submit', 'PENDING SUPERVISOR APPROVAL', '', '', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'SUPERVISOR', 'Submit', 'PENDING FINAL APPROVAL', '', '', 0),
  ('CLAIM_REQUEST', 'DRAFT', 'ADMIN', 'Submit', 'APPROVED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'SUPERVISOR', 'Approve', 'PENDING FINAL APPROVAL', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'SUPERVISOR', 'Update', 'PENDING SUPERVISOR APPROVAL', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'ADMIN', 'Update', 'PENDING SUPERVISOR APPROVAL', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'ADMIN', 'Approve', 'APPROVED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'SUPERVISOR', 'Reject', 'REJECTED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING SUPERVISOR APPROVAL', 'ADMIN', 'Reject', 'REJECTED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING FINAL APPROVAL', 'ADMIN', 'Approve', 'APPROVED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING FINAL APPROVAL', 'ADMIN', 'Reject', 'REJECTED', '', '', 0),
  ('CLAIM_REQUEST', 'PENDING FINAL APPROVAL', 'ADMIN', 'Update', 'PENDING FINAL APPROVAL', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'REJECTED', 'ESS USER', 'Update', 'REJECTED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'REJECTED', 'ESS USER', 'Submit', 'PENDING SUPERVISOR APPROVAL', '', '', 0),
  ('CLAIM_REQUEST', 'REJECTED', 'ADMIN', 'Read', 'REJECTED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'REJECTED', 'SUPERVISOR', 'Read', 'REJECTED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'APPROVED', 'ADMIN', 'Read', 'APPROVED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'APPROVED', 'SUPERVISOR', 'Read', 'APPROVED', '', 'INVISIBLE', 0),
  ('CLAIM_REQUEST', 'PENDING FINAL APPROVAL', 'SUPERVISOR', 'Read', 'PENDING FINAL APPROVAL', '', 'INVISIBLE', 0);