import jobStatusOptions from '../maintenanceStatus.json';
import jobPriorityOptions from '../maintenancePriority.json';

const STATUS_IMCOMPLETE = 'All Incomplete';
const STATUS_NOT_ACTIONED = 'Not Actioned';
const STATUS_IN_PROGRESS = 'In Progress';
const STATUS_COMPLETED = 'Completed';

const getDefaultPriority = () => jobPriorityOptions.find((p) => p.default);

const getJobPriority = (priority) => {
  let priorityOption = null;
  if (priority) priorityOption = jobPriorityOptions.find((p) => p.name === priority);
  return priorityOption || getDefaultPriority();
};

export {
  STATUS_IMCOMPLETE,
  STATUS_NOT_ACTIONED,
  STATUS_IN_PROGRESS,
  STATUS_COMPLETED,
  jobStatusOptions,
  jobPriorityOptions,
  getDefaultPriority,
  getJobPriority,
};
