import type { WorkerSessionRow } from '../../repositories/worker-platform/index.js'

export function mapWorkerSession(session: WorkerSessionRow, currentSessionId: string) {
  return {
    sessionId: session.session_id,
    deviceId: session.device_id,
    deviceType: session.device_type,
    deviceName: session.device_name,
    userAgent: session.user_agent,
    ipAddress: session.ip_address,
    issuedAt: session.issued_at,
    lastSeenAt: session.last_seen_at,
    expiresAt: session.expires_at,
    current: session.session_id === currentSessionId,
  }
}
