package de.avatic.lcc.service.transformer.generic;

import de.avatic.lcc.dto.generic.LocationDTO;
import de.avatic.lcc.model.db.nodes.Location;
import de.avatic.lcc.model.db.nodes.Node;
import de.avatic.lcc.model.db.premises.route.RouteNode;
import org.springframework.stereotype.Service;

@Service
public class LocationTransformer {
    public LocationDTO toLocationDTO(Node entity) {
        return new LocationDTO(entity.getGeoLat().doubleValue(), entity.getGeoLng().doubleValue());
    }

    public LocationDTO toLocationDTO(Location entity) {
        return new LocationDTO(entity.getLatitude(), entity.getLongitude());
    }

    public LocationDTO toLocationDTO(RouteNode entity) {
        return new LocationDTO(entity.getGeoLat().doubleValue(), entity.getGeoLng().doubleValue());
    }
}
