import type { CalculatedTimeBlock, CompanyHoliday, EligibilityRule, HolidayCalendar, ReportedTimeBlock, Schema, TimeClockEvent, TimeClockEventVoid, TimeCorrectionLog, TimeEntryCode, Timecard, WorkRule, WorkRuleAssignment, } from "../lib/types"; export const baseTimeClockEvent = { id: "time-clock-event-1", assignmentId: "assignment-1", eventType: "CLOCK_IN", occurredAt: new Date("2024-02-01T09:00:00.000Z"), source: "WEB", createdAt: new Date("2024-02-01T09:00:00.000Z"), updatedAt: new Date("2024-02-01T09:00:00.000Z"), } as const satisfies TimeClockEvent; export const clockOutEvent = { id: "time-clock-event-2", assignmentId: "assignment-1", eventType: "CLOCK_OUT", occurredAt: new Date("2024-02-01T18:00:00.000Z"), source: "WEB", createdAt: new Date("2024-02-01T18:00:00.000Z"), updatedAt: new Date("2024-02-01T18:00:00.000Z"), } as const satisfies TimeClockEvent; export const baseTimeClockEventVoid = { id: "time-clock-event-void-1", targetEventId: baseTimeClockEvent.id, action: "VOID", sequence: 1, actorId: "user-1", occurredAt: new Date("2024-02-01T10:00:00.000Z"), reasonCode: "DUPLICATE", reasonNote: "Duplicate punch", authority: "MANAGER", createdAt: new Date("2024-02-01T10:00:00.000Z"), updatedAt: new Date("2024-02-01T10:00:00.000Z"), } as const satisfies TimeClockEventVoid; export const baseReportedTimeBlock = { id: "reported-time-block-1", assignmentId: "assignment-1", workDate: new Date("2024-02-01T00:00:00.000Z"), blockType: "WORK", sourceKind: "PUNCH_DERIVED", startAt: new Date("2024-02-01T09:00:00.000Z"), endAt: new Date("2024-02-01T18:00:00.000Z"), correctionReason: null, supersededByBlockId: null, createdAt: new Date("2024-02-01T18:00:00.000Z"), updatedAt: new Date("2024-02-01T18:00:00.000Z"), } as const satisfies ReportedTimeBlock; export const supersededReportedTimeBlock = { ...baseReportedTimeBlock, id: "reported-time-block-2", supersededByBlockId: "reported-time-block-3", } as const satisfies ReportedTimeBlock; export const correctionReportedTimeBlock = { ...baseReportedTimeBlock, id: "reported-time-block-3", correctionReason: "Missed break punch", } as const satisfies ReportedTimeBlock; export const morningWorkBlock = { ...baseReportedTimeBlock, id: "reported-time-block-morning", startAt: new Date("2024-02-01T09:00:00.000Z"), endAt: new Date("2024-02-01T12:00:00.000Z"), } as const satisfies ReportedTimeBlock; export const afternoonWorkBlock = { ...baseReportedTimeBlock, id: "reported-time-block-afternoon", startAt: new Date("2024-02-01T13:00:00.000Z"), endAt: new Date("2024-02-01T18:00:00.000Z"), } as const satisfies ReportedTimeBlock; export const baseTimecard = { id: "timecard-1", assignmentId: "assignment-1", periodStart: new Date("2024-02-01T00:00:00.000Z"), periodEnd: new Date("2024-02-29T00:00:00.000Z"), status: "OPEN", categoryTotals: [], submittedAt: null, approvedAt: null, approvedBy: null, lockedAt: null, lockedBy: null, historicalCorrection: false, createdAt: new Date("2024-02-01T00:00:00.000Z"), updatedAt: new Date("2024-02-01T00:00:00.000Z"), } as const satisfies Timecard; export const submittedTimecard = { id: "timecard-3", assignmentId: "assignment-1", periodStart: new Date("2024-03-01T00:00:00.000Z"), periodEnd: new Date("2024-03-31T00:00:00.000Z"), status: "SUBMITTED", categoryTotals: [{ category: "REGULAR", minutes: 9600 }], submittedAt: new Date("2024-04-01T00:00:00.000Z"), approvedAt: null, approvedBy: null, lockedAt: null, lockedBy: null, historicalCorrection: false, createdAt: new Date("2024-03-01T00:00:00.000Z"), updatedAt: new Date("2024-03-01T00:00:00.000Z"), } as const satisfies Timecard; export const approvedTimecard = { id: "timecard-4", assignmentId: "assignment-1", periodStart: new Date("2024-04-01T00:00:00.000Z"), periodEnd: new Date("2024-04-30T00:00:00.000Z"), status: "APPROVED", categoryTotals: [{ category: "REGULAR", minutes: 9600 }], submittedAt: new Date("2024-05-01T00:00:00.000Z"), approvedAt: new Date("2024-05-02T00:00:00.000Z"), approvedBy: "user-1", lockedAt: null, lockedBy: null, historicalCorrection: false, createdAt: new Date("2024-04-01T00:00:00.000Z"), updatedAt: new Date("2024-04-01T00:00:00.000Z"), } as const satisfies Timecard; export const lockedTimecard = { id: "timecard-2", assignmentId: "assignment-2", periodStart: new Date("2024-01-01T00:00:00.000Z"), periodEnd: new Date("2024-01-31T00:00:00.000Z"), status: "LOCKED", categoryTotals: [ { category: "OVERTIME", minutes: 600 }, { category: "REGULAR", minutes: 9600 }, ], submittedAt: new Date("2024-02-01T00:00:00.000Z"), approvedAt: new Date("2024-02-02T00:00:00.000Z"), approvedBy: "user-1", lockedAt: new Date("2024-02-03T00:00:00.000Z"), lockedBy: "admin-user", historicalCorrection: false, createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies Timecard; export const baseCalculatedTimeBlock = { id: "calculated-time-block-1", assignmentId: "assignment-1", workDate: new Date("2024-02-01T00:00:00.000Z"), category: "REGULAR", startAt: new Date("2024-02-01T09:00:00.000Z"), endAt: new Date("2024-02-01T18:00:00.000Z"), minutes: 480, timeEntryCodeKey: "WORK_REGULAR", payCodeKey: "REGULAR", workRuleId: "work-rule-1", calculationTagKeys: ["WORK_RULE_V1"], sourceReportedBlockIds: [baseReportedTimeBlock.id], createdAt: new Date("2024-02-01T18:00:00.000Z"), updatedAt: new Date("2024-02-01T18:00:00.000Z"), } as const satisfies CalculatedTimeBlock; export const secondCalculatedTimeBlock = { id: "calculated-time-block-2", assignmentId: "assignment-1", workDate: new Date("2024-02-01T00:00:00.000Z"), category: "OVERTIME", startAt: new Date("2024-02-01T18:00:00.000Z"), endAt: new Date("2024-02-01T19:30:00.000Z"), minutes: 90, timeEntryCodeKey: "WORK_OVERTIME", payCodeKey: "OVERTIME_125", workRuleId: "work-rule-1", calculationTagKeys: ["WORK_RULE_V1", "OVERTIME_THRESHOLD_EXCEEDED"], sourceReportedBlockIds: [baseReportedTimeBlock.id], createdAt: new Date("2024-02-01T19:30:00.000Z"), updatedAt: new Date("2024-02-01T19:30:00.000Z"), } as const satisfies CalculatedTimeBlock; export const baseTimeCorrectionLog = { id: "time-correction-log-1", timecardId: lockedTimecard.id, targetReportedBlockId: null, field: "OVERTIME", previousValue: "600", newValue: "660", reason: "Missed overtime approval", correctedBy: "user-1", correctedAt: new Date("2024-02-05T00:00:00.000Z"), createdAt: new Date("2024-02-05T00:00:00.000Z"), updatedAt: new Date("2024-02-05T00:00:00.000Z"), } as const satisfies TimeCorrectionLog; // ---- work-rules domain fixtures (merged from modules/work-rules, ADR-020) ---- export const baseTimeEntryCode = { id: "time-entry-code-1", key: "WORK_REGULAR", category: "WORK", displayName: "Regular Work", payMapKey: "REGULAR", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies TimeEntryCode; export const overtimeTimeEntryCode = { id: "time-entry-code-2", key: "OT_BEYOND_STATUTORY", category: "OVERTIME_BEYOND_STATUTORY", displayName: "Statutory Overtime", payMapKey: "OT_STATUTORY", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies TimeEntryCode; export const nightTimeEntryCode = { id: "time-entry-code-3", key: "NIGHT_WORK", category: "NIGHT", displayName: "Night Work", payMapKey: "NIGHT", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies TimeEntryCode; export const holidayStatutoryTimeEntryCode = { id: "time-entry-code-4", key: "HOLIDAY_WORK_STATUTORY", category: "HOLIDAY_STATUTORY", displayName: "Statutory Holiday Work", payMapKey: "HOLIDAY_135", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies TimeEntryCode; export const baseHolidayCalendar = { id: "holiday-calendar-1", key: "JP_NATIONAL", name: "Japan National Holidays", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies HolidayCalendar; export const baseCompanyHoliday = { id: "company-holiday-1", calendarId: baseHolidayCalendar.id, holidayDate: new Date("2024-01-01T00:00:00.000Z"), holidayKind: "STATUTORY", name: "New Year's Day", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies CompanyHoliday; export const secondCompanyHoliday = { id: "company-holiday-2", calendarId: baseHolidayCalendar.id, holidayDate: new Date("2024-05-03T00:00:00.000Z"), holidayKind: "PRESCRIBED", name: "Constitution Memorial Day", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies CompanyHoliday; export const baseWorkRule = { id: "work-rule-1", displayName: "Standard Work Rule", clockInRoundingUnitMinutes: 15, clockInRoundingDirection: "NEAREST", clockOutRoundingUnitMinutes: 15, clockOutRoundingDirection: "NEAREST", breakRoundingUnitMinutes: 15, breakRoundingDirection: "UP", breakDeductionMinutes: 60, dailyOvertimeThresholdMinutes: 480, nightWindowStart: 1320, nightWindowEnd: 300, premiumRatePercent: [ { category: "OVERTIME_BEYOND_STATUTORY", key: null }, { category: "NIGHT", key: null }, ], holidayCalendarId: baseHolidayCalendar.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "work-rule-1", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies WorkRule; export const secondWorkRule = { id: "work-rule-2", displayName: "Flex Work Rule", clockInRoundingUnitMinutes: 5, clockInRoundingDirection: "DOWN", clockOutRoundingUnitMinutes: 5, clockOutRoundingDirection: "DOWN", breakRoundingUnitMinutes: 5, breakRoundingDirection: "UP", breakDeductionMinutes: 45, dailyOvertimeThresholdMinutes: 480, nightWindowStart: 1320, nightWindowEnd: 300, premiumRatePercent: [{ category: "HOLIDAY_STATUTORY", key: null }], holidayCalendarId: null, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "work-rule-2", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies WorkRule; export const baseEligibilityRule = { id: "eligibility-rule-1", targetType: "EMPLOYMENT_TYPE", targetId: "employment-type-1", grantType: "WORK_RULE", workRuleId: baseWorkRule.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "eligibility-rule-1", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies EligibilityRule; export const secondWorkRuleEligibilityRule = { id: "eligibility-rule-2", targetType: "POSITION", targetId: "position-1", grantType: "WORK_RULE", workRuleId: secondWorkRule.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "eligibility-rule-2", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies EligibilityRule; export const expiredEligibilityRule = { id: "eligibility-rule-4", targetType: "EMPLOYMENT_TYPE", targetId: "employment-type-1", grantType: "WORK_RULE", workRuleId: baseWorkRule.id, effectiveStart: new Date("2022-01-01T00:00:00.000Z"), effectiveEnd: new Date("2023-12-31T00:00:00.000Z"), versionOf: "eligibility-rule-4", createdAt: new Date("2022-01-01T00:00:00.000Z"), updatedAt: new Date("2022-01-01T00:00:00.000Z"), } as const satisfies EligibilityRule; export const futureEligibilityRule = { id: "eligibility-rule-6", targetType: "EMPLOYMENT_TYPE", targetId: "employment-type-1", grantType: "WORK_RULE", workRuleId: secondWorkRule.id, effectiveStart: new Date("2099-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "eligibility-rule-6", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies EligibilityRule; export const workerEligibilityRule = { id: "eligibility-rule-5", targetType: "WORKER", targetId: "worker-1", grantType: "WORK_RULE", workRuleId: baseWorkRule.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "eligibility-rule-5", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies EligibilityRule; export const workRuleReferencingTimeEntryCode = { id: "work-rule-3", displayName: "TimeEntryCode-Referencing Work Rule", clockInRoundingUnitMinutes: 15, clockInRoundingDirection: "NEAREST", clockOutRoundingUnitMinutes: 15, clockOutRoundingDirection: "NEAREST", breakRoundingUnitMinutes: 15, breakRoundingDirection: "UP", breakDeductionMinutes: 60, dailyOvertimeThresholdMinutes: 480, nightWindowStart: 1320, nightWindowEnd: 300, premiumRatePercent: [{ category: "WORK", key: baseTimeEntryCode.key }], holidayCalendarId: null, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "work-rule-3", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies WorkRule; export const baseWorkRuleAssignment = { id: "work-rule-assignment-1", targetType: "WORKER", targetId: "worker-1", workRuleId: baseWorkRule.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "work-rule-assignment-1", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies WorkRuleAssignment; export const employmentTypeWorkRuleAssignment = { id: "work-rule-assignment-2", targetType: "EMPLOYMENT_TYPE", targetId: "employment-type-1", workRuleId: secondWorkRule.id, effectiveStart: new Date("2024-01-01T00:00:00.000Z"), effectiveEnd: null, versionOf: "work-rule-assignment-2", createdAt: new Date("2024-01-01T00:00:00.000Z"), updatedAt: new Date("2024-01-01T00:00:00.000Z"), } as const satisfies WorkRuleAssignment;