/** * Shared type definitions for Routes and Adventures */ // ============================================================================ // GeoJSON Types // ============================================================================ export interface GeoJSONPoint { type: 'Point'; coordinates: [number, number]; // [longitude, latitude] } export interface GeoJSONLineString { type: 'LineString'; coordinates: Array<[number, number]>; // Array of [longitude, latitude] } export interface GeoJSONPolygon { type: 'Polygon'; coordinates: Array>; } export type GeoJSONGeometry = GeoJSONPoint | GeoJSONLineString | GeoJSONPolygon; export interface GeoJSONFeature { type: 'Feature'; geometry: G; properties: P; } export interface GeoJSONFeatureCollection { type: 'FeatureCollection'; features: Array>; } // ============================================================================ // Track Types (Public Ski Tracks) // ============================================================================ export interface TrackProperties { id: number; name: string; description?: string; difficulty?: string; // e.g., 'beginner', 'intermediate', 'advanced', 'expert' type?: string; // e.g., 'downhill', 'nordic', 'skitour' 'piste:difficulty'?: string; // From OpenSkiData 'piste:type'?: string; // From OpenSkiData [key: string]: any; // Allow additional properties from GeoJSON } export interface Track { id: number; external_id?: string; name: string; description?: string; geojson: GeoJSONGeometry; // The path geometry properties: Record; // Additional properties from GeoJSON difficulty?: string; difficulty_convention?: string; type?: string; uses?: string[]; ref?: string; oneway?: string; gladed?: string; patrolled?: string; lit?: string; grooming?: string; status?: string; websites?: string[]; wikidata_id?: string; elevation_profile?: any; created_at?: Date; } export type TrackFeature = GeoJSONFeature; export type TrackFeatureCollection = GeoJSONFeatureCollection; // ============================================================================ // Adventure Types (User-Saved Activities) // ============================================================================ export interface AdventureProperties { id: number; name: string; description?: string; user_id?: string; recorded_at?: Date; duration?: number; // Duration in seconds distance?: number; // Distance in meters [key: string]: any; // Allow additional properties } export interface Adventure { id: number; user_id?: string; name: string; description?: string; path: GeoJSONGeometry; // The recorded path properties: Record; // Additional properties recorded_at?: Date; created_at?: Date; } export type AdventureFeature = GeoJSONFeature; export type AdventureFeatureCollection = GeoJSONFeatureCollection; // ============================================================================ // Activity Types (UI taxonomy) // ============================================================================ export interface Activity { id: string; // stable identifier used by routes.uses label: string; sort_order?: number; is_visible?: boolean; } // ============================================================================ // API Response Types // ============================================================================ export interface PaginationInfo { total: number; page: number; limit: number; pages: number; } export interface PaginatedResponse { type: 'FeatureCollection'; features: T[]; pagination: PaginationInfo; }