/**
 * TimeEntry Database Mapper
 *
 * Maps between TimeEntry domain objects and SQLite database rows.
 */
export function toDatabase(entry) {
    return {
        id: entry.id,
        work_item_id: entry.workItemId,
        duration_minutes: entry.durationMinutes,
        note: entry.note ?? null,
        logged_at: entry.loggedAt instanceof Date ? entry.loggedAt.getTime() : entry.loggedAt,
        created_at: entry.createdAt instanceof Date ? entry.createdAt.getTime() : entry.createdAt,
        updated_at: entry.updatedAt instanceof Date ? entry.updatedAt.getTime() : entry.updatedAt,
    };
}
export function fromDatabase(row) {
    return {
        id: row.id,
        workItemId: row.work_item_id,
        durationMinutes: row.duration_minutes,
        note: row.note ?? undefined,
        loggedAt: new Date(row.logged_at),
        createdAt: new Date(row.created_at),
        updatedAt: new Date(row.updated_at),
    };
}
