Spaces:
Sleeping
Sleeping
| /** | |
| * 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<Array<[number, number]>>; | |
| } | |
| export type GeoJSONGeometry = GeoJSONPoint | GeoJSONLineString | GeoJSONPolygon; | |
| export interface GeoJSONFeature<G extends GeoJSONGeometry = GeoJSONGeometry, P = any> { | |
| type: 'Feature'; | |
| geometry: G; | |
| properties: P; | |
| } | |
| export interface GeoJSONFeatureCollection<G extends GeoJSONGeometry = GeoJSONGeometry, P = any> { | |
| type: 'FeatureCollection'; | |
| features: Array<GeoJSONFeature<G, P>>; | |
| } | |
| // ============================================================================ | |
| // 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<string, any>; // 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<GeoJSONLineString, TrackProperties>; | |
| export type TrackFeatureCollection = GeoJSONFeatureCollection<GeoJSONLineString, TrackProperties>; | |
| // ============================================================================ | |
| // 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<string, any>; // Additional properties | |
| recorded_at?: Date; | |
| created_at?: Date; | |
| } | |
| export type AdventureFeature = GeoJSONFeature<GeoJSONLineString, AdventureProperties>; | |
| export type AdventureFeatureCollection = GeoJSONFeatureCollection<GeoJSONLineString, AdventureProperties>; | |
| // ============================================================================ | |
| // 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<T> { | |
| type: 'FeatureCollection'; | |
| features: T[]; | |
| pagination: PaginationInfo; | |
| } | |