import type { ArtPointConfiguration } from './art-workflow-points' import type { DingWorkflowDeliveryAssessment } from './ding-workflow-delivery' /** Delivery exemptions apply to the whole workflow; point exemptions remain person/role specific. */ export function deliveryExemptWorkflowKeys(config: Pick) { return new Set(config.overtimeExemptions .filter(item => item.enabled !== false && item.workflowKey.trim()) .map(item => item.workflowKey.trim())) } export function applyDeliveryExemption( assessment: DingWorkflowDeliveryAssessment, workflowKey: string | null | undefined, exemptKeys: ReadonlySet, ): DingWorkflowDeliveryAssessment { // Missing timing/standards must remain pending, even when a configuration exists. return assessment.status === 'overtime' && exemptKeys.has(workflowKey?.trim() || '') ? { ...assessment, status: 'on_time', overtimeExempted: true } : assessment }