/**
 * @ai-summary Type definitions for stations feature
 * @ai-context Gas station discovery and caching
 */

export interface Station {
  id: string;
  placeId: string; // Google Places ID
  name: string;
  address: string;
  latitude: number;
  longitude: number;
  priceRegular?: number;
  pricePremium?: number;
  priceDiesel?: number;
  lastUpdated?: Date;
  distance?: number; // Distance from search point in meters
  isOpen?: boolean;
  rating?: number;
  photoReference?: string;
  isSaved?: boolean;
  savedMetadata?: StationSavedMetadata;
}

export interface StationSearchRequest {
  latitude: number;
  longitude: number;
  radius?: number; // Radius in meters (default 5000)
  fuelType?: 'regular' | 'premium' | 'diesel';
}

export interface StationSearchResponse {
  stations: Station[];
  searchLocation: {
    latitude: number;
    longitude: number;
  };
  searchRadius: number;
  timestamp: string;
}

export interface SavedStation {
  id: string;
  userId: string;
  stationId: string;
  placeId: string;
  nickname?: string;
  notes?: string;
  isFavorite: boolean;
  has93Octane: boolean;
  has93OctaneEthanolFree: boolean;
  createdAt: Date;
  updatedAt: Date;
}

// Fastify-specific types for HTTP handling
export interface StationSearchBody {
  latitude: number;
  longitude: number;
  radius?: number;
  fuelType?: 'regular' | 'premium' | 'diesel';
}

export interface SaveStationBody {
  placeId: string;
  nickname?: string;
  notes?: string;
  isFavorite?: boolean;
  has93Octane?: boolean;
  has93OctaneEthanolFree?: boolean;
}

export interface StationParams {
  placeId: string;
}

export interface UpdateSavedStationBody {
  nickname?: string;
  notes?: string;
  isFavorite?: boolean;
  has93Octane?: boolean;
  has93OctaneEthanolFree?: boolean;
}

export interface StationSavedMetadata {
  nickname?: string;
  notes?: string;
  isFavorite: boolean;
  has93Octane: boolean;
  has93OctaneEthanolFree: boolean;
}

export interface StationMatchBody {
  merchantName: string;
}

export interface StationMatchResponse {
  matched: boolean;
  station: Station | null;
}
