#ifndef MODULE_CALL_HELP_H
#define MODULE_CALL_HELP_H

/**
  *@brief 呼救模块
  * 把呼救消息保存到数据库,同时推送给web
  * @author 戴月腾
  * @date 2018-08-09
*/

#include "module_singleton_base.h"
#include"card.h"
#include"websocket/sio/sio_client.h"

/**
 * @brief 呼救类
 * 把呼救消息保存到数据库,同时推送给web, 单例
 */
class module_call_help : public singleton_base<module_call_help>
{
private:
    friend class singleton_base<module_call_help>;
    module_call_help()
    {
    }

public:
    /**
     * @brief //1.如果已经有呼救告警
    //2.web取消告警。status_help && status_help_cancel 置为status_help_dealed
    //3.如果底层已经没有呼救则,取消后,不会再次进行呼救。因为status_help已经不会置为status_error。
    //4.如果底层还在呼救。这时候不管status_help是何种状态,极大的可能是error.status_help_cancel的存在都会取消。
    //并且还要保证等待线程把json传送到前端
     */
    void rev_from_card_help(std::shared_ptr<card_location_base> card_ptr);

    /**
     * @brief 接收到web端发来的处理呼救请求
     * @param data_map
     */
    void accept_web_deal_help(sio::message::ptr const& data);

    static std::string get_json_help();
};


#endif