#ifndef AREA_BUSINESS_SPEED_CHECKER_H
#define AREA_BUSINESS_SPEED_CHECKER_H

#include<unordered_map>
#include"area_business.h"

class area_business_speed_checker : public area_business
{
public:
    area_business_speed_checker();

    virtual int area_business_type()
    {
        return 4;
    }

    void on_load_his(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);

    void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
    void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
    void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);

    static void init_vehicle_category_from_db();

private:
    static double _get_mine_limit_speed(int category_id)
    {
        auto serch = _vehicle_category_map.find(category_id);
        if(serch == _vehicle_category_map.end())
        {
            return 0;
        }

        return serch->second;
    }

private:
    static std::unordered_map<int,double> _vehicle_category_map;
};

#endif // AREA_BUSINESS_SPEED_CHECKER_H
