export interface Location { id?: number; latitude: number | string; // NocoDB returns string longitude: number | string; // NocoDB returns string timestamp: string; user_id: number | string; // NocoDB returns string "0" for MQTT devices first_name: string | null; last_name: string | null; username: string | null; marker_label: string | null; display_time: string | null; chat_id: number | string; // Also string in API response battery?: number | null; speed?: number | null; created_at?: string; } export interface LocationResponse { success: boolean; current: Location | null; history: Location[]; total_points: number; last_updated: string; } export interface Device { id: string; name: string; color: string; } // Geofence types export interface Geofence { id: string; name: string; description: string | null; // Geometry shape_type: 'circle'; center_latitude: number; center_longitude: number; radius_meters: number; // Assignment owner_id: string; device_id: string; // Status & Metadata is_active: number; // 0 or 1 color: string; // Timestamps created_at: string; updated_at: string; } export interface GeofenceEvent { id?: number; geofence_id: string; device_id: string; location_id: number; // Event details event_type: 'enter' | 'exit'; latitude: number | string; longitude: number | string; // Metadata distance_from_center: number | null; notification_sent: number; // 0 = pending, 1 = sent, 2 = failed notification_error: string | null; // Timestamps timestamp: string; created_at?: string; } export interface GeofenceStatus { id?: number; device_id: string; geofence_id: string; // Current status is_inside: number; // 0 or 1 last_enter_time: string | null; last_exit_time: string | null; last_checked_at: string | null; // Timestamps created_at?: string; updated_at?: string; } // Input types for creating/updating geofences export interface CreateGeofenceInput { id: string; name: string; description?: string; center_latitude: number; center_longitude: number; radius_meters: number; owner_id: string; device_id: string; color?: string; } export interface CreateGeofenceEventInput { geofence_id: string; device_id: string; location_id: number; event_type: 'enter' | 'exit'; latitude: number | string; longitude: number | string; distance_from_center: number; timestamp: string; }