import type {ApiDeviceSession} from '@/services/api/types'; /** A signed-in device, as the settings screen consumes it. */ export interface DeviceSession { id: string; device: string; createdAt: string; lastUsedAt: string; expiresAt: string; /** The browser reading this page. Warn before signing it out. */ isCurrent: boolean; } export function toDeviceSession(s: ApiDeviceSession): DeviceSession { return { id: s.id, // The platform records whatever the client sent at sign-in. An empty label // is possible, and "Unknown device" is more honest than a blank row. device: s.device || 'Unknown device', createdAt: s.created_at, lastUsedAt: s.last_used_at, expiresAt: s.expires_at, isCurrent: s.current, }; }