export const WORK_ORDER_TIMEOUT_POLICIES = ['reopen', 'cancel_release', 'cancel_deduct'] as const

export type WorkOrderTimeoutPolicy = (typeof WORK_ORDER_TIMEOUT_POLICIES)[number]

export function isWorkOrderTimeoutPolicy(value: unknown): value is WorkOrderTimeoutPolicy {
  return WORK_ORDER_TIMEOUT_POLICIES.includes(value as WorkOrderTimeoutPolicy)
}

export function normalizeWorkOrderTimeoutPolicy(value: unknown): WorkOrderTimeoutPolicy {
  return isWorkOrderTimeoutPolicy(value) ? value : 'reopen'
}
