export interface ApiEnvelope { data: T } export interface ApiError { code: string message: string details: Record | unknown[] } export interface ApiErrorEnvelope { error: ApiError } export interface ProjectRead { id: string name: string description?: string | null region: string status: string created_at?: string | null updated_at?: string | null } export interface ProjectCreate { name: string description?: string | null region?: string } export interface ProjectListResponse { items: ProjectRead[] total: number limit: number offset: number } export interface DemoWorkflowResponse { project_id: string area_id: string reference_dataset_id: string candidate_dataset_id: string raster_dataset_id?: string | null quality_check_id: string metric_count: number status: string message: string created: boolean } export interface AreaRead { id: string project_id: string name: string original_crs?: string | null area_m2?: number | null created_at?: string | null geometry_type?: string | null geometry?: GeoJSON.Polygon | GeoJSON.MultiPolygon | null } export interface AreaCreate { name: string geometry: GeoJSON.Polygon | GeoJSON.MultiPolygon crs?: string } export interface AreaListResponse { items: AreaRead[] total: number limit: number offset: number } export interface DatasetCreateResponse { id: string name: string dataset_type: string source: string dataset_role?: string source_name?: string | null reference_layer_name?: string | null source_metadata?: Record | null provenance_metadata?: Record | null imported_at?: string | null project_id: string area_id?: string | null storage_path?: string | null original_filename?: string | null stored_filename?: string | null content_type?: string | null size_bytes?: number | null checksum_sha256?: string | null crs?: string | null bounds_json?: Record | null metadata_json?: Record | null vector_summary?: VectorSummary | null status: string derived_from_dataset_id?: string | null created_at?: string | null feature_count?: number | null } export interface JobRead { id: string job_type: string status: string project_id: string dataset_id?: string | null input_dataset_id?: string | null output_dataset_id?: string | null parameters_json: Record result_json?: Record | null error_message?: string | null created_at?: string | null started_at?: string | null finished_at?: string | null } export interface JobListResponse { items: JobRead[] total: number limit: number offset: number } export interface VectorSummary { feature_count?: number | null geometry_types?: string[] | null bounds_json?: Record | null approximate_area_m2?: number | null crs?: string | null feature_geometry_count?: number | null invalid_features?: number | null crs_assumed?: boolean | null } export interface VectorSummaryResponse { feature_count?: number | null geometry_types?: string[] | null bounds_json?: Record | null approximate_area_m2?: number | null crs?: string | null feature_geometry_count?: number | null invalid_features?: number | null crs_assumed?: boolean | null } export interface RasterMetadataResponse { driver: string dataset_id?: string width: number height: number band_count: number crs?: string | null bounds?: number[] resolution?: number[] dtype?: string[] nodata?: unknown transform?: string[] | number[] | null path?: string size_bytes?: number | null checksum_sha256?: string | null operation?: string | null operation_parameters?: Record | null source_dataset_id?: string | null } export interface RasterInspectResponse { dataset_id: string ready: boolean metadata: Record } export interface RasterPreviewPayload { path: string format: string width: number | null height: number | null } export interface RasterPreviewResponse { dataset_id: string ready: boolean preview: RasterPreviewPayload metadata?: Record } export interface RasterBandStats { band_index: number dtype: string | null min: number | null max: number | null mean: number | null std: number | null nodata_count: number nodata_ratio: number valid_pixel_count: number histogram: number[] | null histogram_bins: number[] | null } export interface RasterStatsResponse { dataset_id: string source_dataset_id?: string | null bands: RasterBandStats[] generated_at?: string | null } export interface RasterNdviRequest { nir_band: number red_band: number output_name?: string } export interface RasterNdwiRequest { green_band: number nir_band: number output_name?: string } export interface RasterNdbiRequest { swir_band: number nir_band: number output_name?: string } export interface RasterTileManifestTile { path: string pixel_window: number[] bounds: number[] transform: number[] index: number } export interface RasterTileManifest { tile_set_id: string source_dataset_id: string source_raster_id: string bounds: number[] tile_size: number overlap: number parameters: Record created_at: string tile_paths: string[] count: number tiles: RasterTileManifestTile[] } export interface RasterTileResponse { dataset_id: string ready: boolean operation: string tile_set_id: string tile_size: number overlap: number manifest_path: string count: number manifest: RasterTileManifest } export interface VectorBBoxResponse { dataset_id: string bounds_json: Record | null feature_count: number crs?: string | null } export interface VectorStatsResponse { dataset_id: string feature_count: number geometry_type_summary: Record bounds_json: Record | null crs?: string | null } export interface DatasetListResponse { items: DatasetCreateResponse[] total: number limit: number offset: number } export interface GeojsonEnvelopeResponse { data: object } export interface ChangeDetectionRequest { source_dataset_id: string target_dataset_id: string iou_threshold: number include_unchanged: boolean } export interface ChangeDetectionSummary { source_dataset_id: string target_dataset_id: string source_feature_count: number target_feature_count: number added_count: number removed_count: number unchanged_count: number iou_threshold: number warnings: string[] generated_at: string geojson: GeoJSON.FeatureCollection } export interface ProviderCapability { provider_name: string display_name: string authority_level: 'authoritative' | 'contextual' | 'manual' | 'fixture' | string supported_layers: string[] supported_geometry_types: string[] supported_query_modes: string[] fetch_signature: string configured: boolean status: string limitation_message: string attribution: string license_note: string not_configured_reason: string | null } export interface SystemCapabilitiesResponse { status: string service: string version: string database: string | null postgis: boolean rasterio: boolean geopandas: boolean yolo: boolean | string sam: boolean | string grb: string sentinel: string providers: ProviderCapability[] } export interface ProviderCapabilitiesResponse { providers: ProviderCapability[] } export interface ProviderLayersResponse { provider_name: string layers: string[] } export interface ProviderStatusResponse { provider_name: string configured: boolean status: string limitation_message: string } export interface ProviderImportResponse { provider_name: string status: string message: string requested_layers: string[] dataset_id: string | null dataset_role?: string | null source_name?: string | null } export interface DetectionModelCapability { model_id: string display_name: string framework: string task_type: string supported_classes: string[] configured: boolean status: string limitation_message: string version?: string | null } export interface DetectionModelsResponse { models: DetectionModelCapability[] } export interface DetectionRunRequest { project_id: string dataset_id: string model_id: string confidence_threshold: number class_filter?: string[] | null tile_manifest_path?: string | null parameters_json?: Record } export interface DetectionRunResponse { analysis_run_id: string job_id: string project_id: string dataset_id: string model_id: string status: string detection_count: number error_code?: string | null message: string } export interface DetectionRunRead { id: string project_id: string dataset_id?: string | null job_id?: string | null analysis_type: string status: string model_name?: string | null model_version?: string | null parameters_json: Record result_json?: Record | null error_message?: string | null created_at?: string | null started_at?: string | null finished_at?: string | null } export interface DetectionRunListResponse { items: DetectionRunRead[] total: number } export interface DetectionRead { id: string project_id: string dataset_id?: string | null analysis_run_id?: string | null job_id?: string | null model_name: string model_version?: string | null class_name: string confidence: number bbox_json?: Record | null source_tile_path?: string | null properties_json?: Record | null created_at?: string | null } export interface DetectionListResponse { items: DetectionRead[] total: number } export interface DetectionQaRequest { reference_dataset_id: string iou_threshold: number class_name?: string | null min_confidence?: number | null } export interface DetectionQaResult { status: string quality_check_id: string analysis_run_id: string reference_dataset_id: string candidate_feature_count: number reference_feature_count: number matches: number false_positives: number false_negatives: number precision?: number | null recall?: number | null f1_score?: number | null mean_iou?: number | null iou_threshold: number warnings: string[] } export type SegmentationModelCapability = DetectionModelCapability export interface SegmentationModelsResponse { models: SegmentationModelCapability[] } export interface SegmentationRunRequest { project_id: string dataset_id: string model_id: string confidence_threshold: number class_filter?: string[] | null tile_manifest_path?: string | null parameters_json?: Record } export interface SegmentationRunResponse { analysis_run_id: string job_id: string project_id: string dataset_id: string model_id: string status: string segmentation_count: number error_code?: string | null message: string } export interface SegmentationRunRead { id: string project_id: string dataset_id?: string | null job_id?: string | null analysis_type: string status: string model_name?: string | null model_version?: string | null parameters_json: Record result_json?: Record | null error_message?: string | null created_at?: string | null started_at?: string | null finished_at?: string | null } export interface SegmentationRunListResponse { items: SegmentationRunRead[] total: number } export interface SegmentationRead { id: string project_id: string dataset_id?: string | null analysis_run_id?: string | null job_id?: string | null model_name: string model_version?: string | null class_name: string confidence?: number | null bbox_json?: Record | null area_m2?: number | null mask_path?: string | null source_tile_path?: string | null tile_index?: number | null properties_json?: Record | null provenance_json?: Record | null created_at?: string | null } export interface SegmentationListResponse { items: SegmentationRead[] total: number } export interface SegmentationQaRequest { reference_dataset_id: string iou_threshold: number class_name?: string | null min_confidence?: number | null } export type SegmentationQaResult = DetectionQaResult export interface QaComparisonRequest { candidate_dataset_id: string reference_dataset_id: string iou_threshold: number area_id?: string | null } export interface QaComparisonResult { status: string warnings: string[] candidate_feature_count: number reference_feature_count: number matches: number false_positives: number false_negatives: number precision: number | null recall: number | null f1_score: number | null mean_iou: number | null iou_threshold: number unsupported_geometry: boolean unsupported_geometries: string[] generated_at: string } export interface MetricRead { id: string quality_check_id?: string | null analysis_run_id?: string | null metric_key: string metric_value?: number | null metric_unit?: string | null label?: string | null metadata_json?: Record | null created_at?: string | null } export interface QualityCheckRead { id: string project_id: string job_id?: string | null analysis_run_id?: string | null candidate_dataset_id?: string | null reference_dataset_id: string check_type: string status: string score?: number | null parameters_json?: Record | null findings_json?: Record | null created_at?: string | null completed_at?: string | null metrics: MetricRead[] } export interface QualityCheckListResponse { items: QualityCheckRead[] total: number limit: number offset: number } export type ExportKind = 'dataset' | 'detection_run' | 'segmentation_run' export interface ExportRead { id: string project_id: string analysis_run_id?: string | null export_type: string storage_path: string metadata_json?: Record | null created_at?: string | null status: string } export interface ExportCreateResponse { export_id: string path: string status: string export_type: string metadata_json?: Record | null } export interface ExportListResponse { items: ExportRead[] total: number limit: number offset: number } export interface ExportContentResponse { export_id: string export_type: string content: Record }