#ifndef _JFXMAP_PYTHON_H_
#define _JFXMAP_PYTHON_H_

#include <pybind11/pybind11.h>
#include <pybind11/stl_bind.h>
#include <pybind11/stl.h>
#include <string>

namespace py = pybind11;

struct MapInfo
{
    int isInMap;
    long lOutRaodId;
    std::vector<long> vctlOutPreRoadId;
    std::vector<long> vctlOutNxtRoadId;
    int nLaneCnt;
    int nOutLaneNum;
    int nOutLaneType;
    int nOutLeftEdgeCrossType;
    int nOutRightEdgeCrossType;
    int nOutSpeedLimit;
    double dOutLaneAngle;
    double ptOutFoot_lat;
    double ptOutFoot_lon;
};

int add(int i, int j);

bool InitMap(std::string strPrjPath, std::string strCfgPath);

MapInfo* GetMapData(double lat,double lon,double carAngle);

PYBIND11_MODULE(libjfxmap_python, m)
{
    // optional module docstring
    m.doc() = "pybind11 example plugin";

    py::class_<MapInfo>(m, "MapInfo")
        .def_readwrite("isInMap", &MapInfo::isInMap)
        .def_readwrite("lOutRaodId", &MapInfo::lOutRaodId)
        .def_readwrite("vctlOutPreRoadId", &MapInfo::vctlOutPreRoadId)
        .def_readwrite("vctlOutNxtRoadId", &MapInfo::vctlOutNxtRoadId)
        .def_readwrite("nLaneCnt", &MapInfo::nLaneCnt)
        .def_readwrite("nOutLaneNum", &MapInfo::nOutLaneNum)
        .def_readwrite("nOutLaneType", &MapInfo::nOutLaneType)
        .def_readwrite("nOutLeftEdgeCrossType", &MapInfo::nOutLeftEdgeCrossType)
        .def_readwrite("nOutRightEdgeCrossType", &MapInfo::nOutRightEdgeCrossType)
        .def_readwrite("nOutSpeedLimit", &MapInfo::nOutSpeedLimit)
        .def_readwrite("dOutLaneAngle", &MapInfo::dOutLaneAngle)
        .def_readwrite("ptOutFoot_lat", &MapInfo::ptOutFoot_lat)
        .def_readwrite("ptOutFoot_lon", &MapInfo::ptOutFoot_lon);
    // expose add function, and add keyword arguments and default arguments
    m.def("add", &add, "A function which adds two numbers", py::arg("i") = 1, py::arg("j") = 2);
    m.def("InitMap", &InitMap, "A function which init map", py::return_value_policy::copy);
    m.def("GetMapData", &GetMapData, "A function which GetInfo", py::return_value_policy::reference);

    // exporting variables
    m.attr("the_answer") = 42;
    py::object world = py::cast("World");
    m.attr("what") = world;
}

#endif