export interface Coordinates {
  latitude: number;
  longitude: number;
}

export class CoordinatesValidator {
  static isValid(coords: Coordinates | null | undefined): boolean {
    if (!coords) return false;

    return (
      coords.latitude >= -90 &&
      coords.latitude <= 90 &&
      coords.longitude >= -180 &&
      coords.longitude <= 180
    );
  }

  static format(coords: Coordinates): string {
    return `${coords.latitude.toFixed(6)}, ${coords.longitude.toFixed(6)}`;
  }
}
