import * as Crypto from 'expo-crypto'; export interface Visit { id: string; contactId: string; visitedByName: string; visitedById: string; visitDate: number; topic?: string; response?: string; remarks?: string; nextVisitDate?: number; createdAt: number; updatedAt: number; } export function dbToVisit(row: any): Visit { return { id: row.id, contactId: row.contact_id, visitedByName: row.visited_by_name, visitedById: row.visited_by_id, visitDate: row.visit_date, topic: row.topic, response: row.response, remarks: row.remarks, nextVisitDate: row.next_visit_date, createdAt: row.created_at, updatedAt: row.updated_at, }; } export function newVisitId(): string { return Crypto.randomUUID(); } export function formatDate(timestamp: number): string { const d = new Date(timestamp * 1000); return d.toLocaleDateString('en-PH', { year: 'numeric', month: 'short', day: 'numeric' }); }