import { splitLocation } from "../helper";
import { Coordinate, Location, StringLocation } from "../types";

export const KAZAN_CITY_CENTER: Coordinate[] = [55.797557, 49.107295];

export const parseLocation = (stringifiedLocation: StringLocation): Location => {
  const [coordinatesStr, address] = splitLocation(stringifiedLocation);
  const [latitude, longitude] = coordinatesStr.split(',').map(Number);
  return { coordinates: [latitude, longitude], address };
};