class DirectionController {
    static search(origin,destination,waypoints){
        return new Promise((resolve, reject) => {
            let params = `?origin=${origin}&destination=${destination}`;

            if(waypoints != null)
                params += `&waypoints=${waypoints}`;

            ConnectionServer.sendRequest(`direction/search${params}`,"GET",null,resolve,reject,undefined,false);
        });
    }


    static searchNative(origin,destination,waypoints){
        let params = `?origin=${origin}&destination=${destination}&simpleDirections=1`;

        if(waypoints != null)
            params += `&waypoints=${waypoints}`;

        return ConnectionServer.sendRequestNative(`${ConnectionServer.Host()}direction/search${params}`,"get");
    }

    static updateRoute(data){
        return ConnectionServer.sendRequestNative(`${API_HOST_LOCATION}${Session.get("configLocation").port_url}/location/route`,"post",data);
    }
}
