/* * Copyright (C) 2025 TomTom Navigation B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { DynamicMapParams } from "../../schemas/map/dynamicMapSchema"; /** * GeoJSON types for map state caching */ export interface GeoJSONFeature { type: "Feature"; geometry: { type: string; coordinates: unknown; }; properties: Record | null; } export interface GeoJSONFeatureCollection { type: "FeatureCollection"; features: GeoJSONFeature[]; } export type DynamicMapOptions = Omit; export type MapMarker = NonNullable[number]; export type MapPolygon = NonNullable[number]; /** * What the map shows, for the agent: clients without MCP app support get * this in place of the map itself. */ export interface DynamicMapSummary { view: MapState["view"]; markers?: Array<{ label: string; position: [number, number]; category?: string }>; routes?: Array<{ name: string; distance?: string; travelTime?: string; trafficDelay?: string; lengthInMeters?: number; travelTimeInSeconds?: number; trafficDelayInSeconds?: number; }>; areas?: Array<{ label: string }>; } /** * Response type for dynamic map service */ export interface DynamicMapResponse { summary: DynamicMapSummary; /** Style, viewport, sources and layers for the interactive app to render. */ mapState: MapState; } /** * Layer definition for MapLibre GL (compatible with both Native and JS) */ export interface LayerDefinition { id: string; type: "circle" | "line" | "fill" | "symbol"; source: string; layout?: Record; paint?: Record; filter?: unknown[]; } export type MapSourceName = "markers" | "routes" | "routeLabels" | "polygons" | "polygonCenters"; /** * Map state for MCP app client-side rendering * Contains all data needed to recreate the map with MapLibre GL JS */ export interface MapState { style: { endpoint: string; params: Record; }; view: { center: [number, number]; // [lon, lat] zoom: number; bounds: { north: number; south: number; east: number; west: number; }; }; sources: Partial>; layers: LayerDefinition[]; options: { width: number; height: number; showLabels: boolean; }; }