import { randomUUID } from 'expo-crypto';

import type { TaskId } from '@/domain/glide';

/**
 * Mint a fresh task identity. Glide is local-first, so identity is client-owned:
 * a task has a stable id the instant it's created — offline, before it has ever
 * reached a server — which is exactly what lets the future sync layer reconcile
 * without a server round-trip. UUIDs are collision-safe across devices too.
 */
export function newTaskId(): TaskId {
  return randomUUID();
}
