import { b as TimeEntry, T as TimeEntryStatus, A as AuditLog, c as Timesheet, R as RateCard, e as TimeLock } from '../types-ecK2b88Z.js'; export { d as TimeCategory, a as TimeCategoryType } from '../types-ecK2b88Z.js'; export { j as CreateRateCardInput, k as CreateTimeCategoryInput, C as CreateTimeEntryInput, l as CreateTimeLockInput, P as PaginationParams, T as TimeEntryFilter, i as TimesheetQuery, U as UpdateTimeEntryInput, b as approveTimeEntrySchema, e as createRateCardSchema, f as createTimeCategorySchema, c as createTimeEntrySchema, g as createTimeLockSchema, p as paginationSchema, r as rejectTimeEntrySchema, s as submitTimeEntrySchema, a as timeCategoryTypeSchema, h as timeEntryFilterSchema, t as timeEntryStatusSchema, d as timesheetQuerySchema, u as updateTimeEntrySchema } from '../schemas-ZDVMEZ9A.js'; import 'zod'; /** * Business policies and rules for Time Log domain */ declare enum RoundingInterval { NONE = 0, ONE_MINUTE = 1, FIVE_MINUTES = 5, SIX_MINUTES = 6,// 1/10th of an hour FIFTEEN_MINUTES = 15 } /** * Round duration to specified interval */ declare function roundDuration(minutes: number, interval: RoundingInterval): number; /** * Calculate duration between two dates in minutes */ declare function calculateDuration(startAt: Date, endAt: Date): number; /** * Check if two time entries overlap */ declare function detectOverlap(entry1: Pick, entry2: Pick): boolean; /** * Check if multiple entries have overlaps */ declare function findOverlaps(entries: Pick[]): Array<[string, string]>; /** * Validate time entry duration constraints */ declare function validateDuration(startAt: Date, endAt: Date): { valid: boolean; error?: string; }; /** * Check if time entry can be edited based on status */ declare function canEditTimeEntry(status: TimeEntryStatus): boolean; /** * Check if time entry can be submitted */ declare function canSubmitTimeEntry(status: TimeEntryStatus): boolean; /** * Check if time entry can be approved */ declare function canApproveTimeEntry(status: TimeEntryStatus): boolean; /** * Check if time entry can be rejected */ declare function canRejectTimeEntry(status: TimeEntryStatus): boolean; /** * Check if time entry can be locked */ declare function canLockTimeEntry(status: TimeEntryStatus): boolean; /** * Check if time entry can be billed */ declare function canBillTimeEntry(status: TimeEntryStatus): boolean; /** * Calculate total minutes for a collection of time entries */ declare function calculateTotalMinutes(entries: Pick[]): number; /** * Calculate billable minutes for a collection of time entries */ declare function calculateBillableMinutes(entries: Pick[]): number; /** * Group time entries by date */ declare function groupEntriesByDate(entries: TimeEntry[]): Map; /** * Check if a time period is locked */ declare function isPeriodLocked(startAt: Date, endAt: Date, locks: Array<{ periodStart: Date; periodEnd: Date; isActive: boolean; }>): boolean; /** * Validate approval workflow transition */ declare function validateStatusTransition(currentStatus: TimeEntryStatus, newStatus: TimeEntryStatus): { valid: boolean; error?: string; }; /** * Custom error types for Time Log domain */ declare class TimeLogError extends Error { code: string; statusCode: number; details?: Record | undefined; constructor(message: string, code: string, statusCode?: number, details?: Record | undefined); } declare class ValidationError extends TimeLogError { constructor(message: string, details?: Record); } declare class AuthorizationError extends TimeLogError { constructor(message?: string, details?: Record); } declare class NotFoundError extends TimeLogError { constructor(resource: string, id?: string); } declare class ConflictError extends TimeLogError { constructor(message: string, details?: Record); } declare class OverlapError extends ConflictError { constructor(overlappingEntries: Array<[string, string]>); } declare class PeriodLockedError extends ConflictError { constructor(periodStart: Date, periodEnd: Date); } declare class InvalidStatusTransitionError extends ValidationError { constructor(currentStatus: string, targetStatus: string); } declare class RateLimitError extends TimeLogError { constructor(limit: number, window: string); } /** * Workflow management for time entries */ interface WorkflowContext { userId: string; userRole: string; timestamp: Date; } interface SubmitEntriesParams { entries: TimeEntry[]; context: WorkflowContext; locks?: Array<{ periodStart: Date; periodEnd: Date; isActive: boolean; }>; } interface SubmitEntriesResult { entries: TimeEntry[]; auditLogs: Omit[]; } /** * Submit time entries */ declare function submitTimeEntries(params: SubmitEntriesParams): SubmitEntriesResult; interface ApproveEntriesParams { entries: TimeEntry[]; context: WorkflowContext; locks?: Array<{ periodStart: Date; periodEnd: Date; isActive: boolean; }>; } interface ApproveEntriesResult { entries: TimeEntry[]; auditLogs: Omit[]; } /** * Approve time entries */ declare function approveTimeEntries(params: ApproveEntriesParams): ApproveEntriesResult; interface RejectEntriesParams { entries: TimeEntry[]; reason: string; context: WorkflowContext; } interface RejectEntriesResult { entries: TimeEntry[]; auditLogs: Omit[]; } /** * Reject time entries */ declare function rejectTimeEntries(params: RejectEntriesParams): RejectEntriesResult; interface LockEntriesParams { entries: TimeEntry[]; reason?: string; context: WorkflowContext; } interface LockEntriesResult { entries: TimeEntry[]; auditLogs: Omit[]; } /** * Lock time entries */ declare function lockTimeEntries(params: LockEntriesParams): LockEntriesResult; /** * Submit a weekly timesheet */ interface SubmitTimesheetParams { timesheet: Timesheet; entries: TimeEntry[]; context: WorkflowContext; locks?: Array<{ periodStart: Date; periodEnd: Date; isActive: boolean; }>; } interface SubmitTimesheetResult { timesheet: Timesheet; entries: TimeEntry[]; auditLogs: Omit[]; } declare function submitTimesheet(params: SubmitTimesheetParams): SubmitTimesheetResult; /** * Mark entries as billed */ interface BillEntriesParams { entries: TimeEntry[]; invoiceId: string; context: WorkflowContext; } interface BillEntriesResult { entries: TimeEntry[]; auditLogs: Omit[]; } declare function billTimeEntries(params: BillEntriesParams): BillEntriesResult; /** * Finance calculations and exports */ interface CostCalculationParams { entries: TimeEntry[]; rateCards: RateCard[]; roundingInterval?: RoundingInterval; atDate?: Date; } interface EntryCost { entryId: string; projectId: string; developerId: string; originalMinutes: number; roundedMinutes: number; hourlyRate: number; currency: string; cost: number; } /** * Resolve effective rate for a time entry * Precedence: project > client > developer default */ declare function resolveEffectiveRate(entry: TimeEntry, rateCards: RateCard[], atDate?: Date): RateCard | null; /** * Calculate costs for time entries */ declare function calculateEntryCosts(params: CostCalculationParams): EntryCost[]; interface ProjectSummary { projectId: string; totalMinutes: number; billableMinutes: number; nonBillableMinutes: number; totalCost: number; currency: string; entryCount: number; } /** * Aggregate entries by project */ declare function aggregateByProject(entries: TimeEntry[], costs: EntryCost[]): ProjectSummary[]; interface DeveloperSummary { developerId: string; totalMinutes: number; billableMinutes: number; nonBillableMinutes: number; totalCost: number; currency: string; entryCount: number; projectBreakdown: Record; } /** * Aggregate entries by developer */ declare function aggregateByDeveloper(entries: TimeEntry[], costs: EntryCost[]): DeveloperSummary[]; interface DailySummary { date: string; totalMinutes: number; billableMinutes: number; nonBillableMinutes: number; totalCost: number; currency: string; entryCount: number; } /** * Aggregate entries by day */ declare function aggregateByDay(entries: TimeEntry[], costs: EntryCost[]): DailySummary[]; /** * Generate finance export data */ interface FinanceExportParams { entries: TimeEntry[]; rateCards: RateCard[]; roundingInterval?: RoundingInterval; includeNonBillable?: boolean; groupBy?: 'project' | 'developer' | 'day'; } interface FinanceExport { summary: { totalEntries: number; totalMinutes: number; billableMinutes: number; nonBillableMinutes: number; totalCost: number; currency: string; dateRange: { from: Date; to: Date; }; }; costs: EntryCost[]; aggregations: { byProject: ProjectSummary[]; byDeveloper: DeveloperSummary[]; byDay: DailySummary[]; }; } declare function generateFinanceExport(params: FinanceExportParams): FinanceExport; /** * Invoice mapping hook interface */ interface InvoiceMapping { invoiceId: string; clientId: string; projectIds: string[]; dateRange: { from: Date; to: Date; }; entries: TimeEntry[]; totalAmount: number; currency: string; } /** * Map time entries to invoice */ declare function mapToInvoice(entries: TimeEntry[], costs: EntryCost[], invoiceId: string, clientId: string): InvoiceMapping; /** * Time lock management */ interface CreateLockParams { projectId?: string; clientId?: string; periodStart: Date; periodEnd: Date; reason: string; lockedBy: string; } interface CreateLockResult { lock: Omit; auditLog: Omit; } /** * Create a time lock */ declare function createTimeLock(params: CreateLockParams): CreateLockResult; interface UnlockParams { lock: TimeLock; unlockedBy: string; reason?: string; } interface UnlockResult { lock: TimeLock; auditLog: Omit; } /** * Unlock a time lock */ declare function unlockTimeLock(params: UnlockParams): UnlockResult; /** * Check if a time entry conflicts with locks */ declare function checkEntryLockConflict(entry: TimeEntry, locks: TimeLock[]): TimeLock | null; /** * Check if a date range conflicts with locks */ declare function checkPeriodLockConflict(periodStart: Date, periodEnd: Date, projectId?: string, clientId?: string, locks?: TimeLock[]): TimeLock | null; /** * Validate that new lock doesn't overlap with existing locks */ declare function validateLockOverlap(newLock: CreateLockParams, existingLocks: TimeLock[]): void; /** * Get all entries affected by a lock */ declare function getAffectedEntries(lock: TimeLock, entries: TimeEntry[]): TimeEntry[]; /** * Lock manager for bulk operations */ declare class LockManager { private locks; constructor(locks?: TimeLock[]); /** * Add a lock to the manager */ addLock(lock: TimeLock): void; /** * Remove a lock from the manager */ removeLock(lockId: string): void; /** * Get all active locks */ getActiveLocks(): TimeLock[]; /** * Check if an entry is locked */ isEntryLocked(entry: TimeEntry): boolean; /** * Check if a period is locked */ isPeriodLocked(periodStart: Date, periodEnd: Date, projectId?: string, clientId?: string): boolean; /** * Get locks for a specific project */ getProjectLocks(projectId: string): TimeLock[]; /** * Get locks for a specific client */ getClientLocks(clientId: string): TimeLock[]; /** * Get locks within a date range */ getLocksInRange(startDate: Date, endDate: Date): TimeLock[]; } export { type ApproveEntriesParams, type ApproveEntriesResult, AuditLog, AuthorizationError, type BillEntriesParams, type BillEntriesResult, ConflictError, type CostCalculationParams, type CreateLockParams, type CreateLockResult, type DailySummary, type DeveloperSummary, type EntryCost, type FinanceExport, type FinanceExportParams, InvalidStatusTransitionError, type InvoiceMapping, type LockEntriesParams, type LockEntriesResult, LockManager, NotFoundError, OverlapError, PeriodLockedError, type ProjectSummary, RateCard, RateLimitError, type RejectEntriesParams, type RejectEntriesResult, RoundingInterval, type SubmitEntriesParams, type SubmitEntriesResult, type SubmitTimesheetParams, type SubmitTimesheetResult, TimeEntry, TimeEntryStatus, TimeLock, TimeLogError, Timesheet, type UnlockParams, type UnlockResult, ValidationError, type WorkflowContext, aggregateByDay, aggregateByDeveloper, aggregateByProject, approveTimeEntries, billTimeEntries, calculateBillableMinutes, calculateDuration, calculateEntryCosts, calculateTotalMinutes, canApproveTimeEntry, canBillTimeEntry, canEditTimeEntry, canLockTimeEntry, canRejectTimeEntry, canSubmitTimeEntry, checkEntryLockConflict, checkPeriodLockConflict, createTimeLock, detectOverlap, findOverlaps, generateFinanceExport, getAffectedEntries, groupEntriesByDate, isPeriodLocked, lockTimeEntries, mapToInvoice, rejectTimeEntries, resolveEffectiveRate, roundDuration, submitTimeEntries, submitTimesheet, unlockTimeLock, validateDuration, validateLockOverlap, validateStatusTransition };