/** * Analytics event types and shared interfaces for Driftline Analytics */ export type EventType = "account" | "view" | "action"; export type Environment = "dev" | "prod"; export type AnalyticsEvent = { v: 1; appView: string; env: Environment; ts: string; uid: string; type: EventType; name: string; screen?: string; props?: Record; }; export type CollectRequest = AnalyticsEvent | { events: AnalyticsEvent[] }; export type CollectResponse = { success: boolean; count: number; }; export type StatsResponse = { appView: string; env: Environment; totalAccounts: number; totalUsers: number; totalEvents: number; eventsByType: Record; topScreens: Array<{ screen: string; count: number }>; topActions: Array<{ name: string; count: number }>; }; export type AccountsResponse = { appView: string; env: Environment; count: number; }; export type UsersResponse = { appView: string; env: Environment; count: number; }; export type EventsResponse = { appView: string; env: Environment; byType: Record; byName: Record; }; export type ApiKeyRecord = { id: number; app_view: string; api_key: string; created: string; }; export type EventRecord = { id: number; ts: string; app_view: string; env: string; type: string; name: string; uid: string; screen: string | null; props: string | null; };