/*
 * @Description: 数据中心
 * @Version: 1.0
 * @Autor: lishengyin
 * @Date: 2022-04-02 13:58:46
 * @LastEditors: lishengyin
 * @LastEditTime: 2022-06-15 11:17:29
 */
#ifndef __GETCENTER_HPP_
#define __GETCENTER_HPP_

#include <iostream>
#include "Util/logger.h"
#include "Util/NoticeCenter.h"
#include "Poller/EventPoller.h"
#include "Util/SqlPool.h"
#include "Network/TcpClient.h"
#include "Poller/Timer.h"
#include "ins_base.hpp"
#include "dataTypeList.hpp"
#include "requests.h"
#include "axios.h"

using namespace std;
using namespace toolkit;
using namespace hv;

namespace ins{
    
    class GetCenter:public Module
    {
    private:
        GetCenter() : Module("GetCenter"){
        }
        
    public:
        using Ptr = std::shared_ptr<GetCenter>;

        ~GetCenter(){this->Destroy();}

        /**
         * @description: 初始化
         * @param {*}
         * @return {*}
         */        
        int8_t Init() override;

        /**
         * @description: 释放资源
         * @param {*}
         * @return {*}
         */        
        void Destroy() override;

        /**
         * @description: 创建新的实例
         * @param {*}
         * @return {*}
         */        
        static std::shared_ptr<GetCenter> CreateNew();

        /**
         * @description: 获取ptr
         * @param {*}
         * @return {*}
         */        
        static std::shared_ptr<GetCenter> getPtr();

        /**
         * @description: 获取KsToken
         * @param {*}
         * @return {*}
         */        
        bool getKsToken();

        /**
         * @description: 分析格式
         * @param {string} type
         * @param {string} URL
         * @return {*}
         */        
        InsDataFormat getFormat(std::string type, std::string URL);

        /**
         * @description: 获取包类型
         * @param {string} type
         * @return {*}
         */        
        InsPacketTypes getPacketType(std::string type);

        /**
         * @description: 获取数据
         * @param {*}
         * @return {*}
         */        
        bool getData();

        /**
         * @description: 
         * @param {*}
         * @return {*}
         */             
        vector<vector<std::string>> ExecuteSql(std::string& sql);

        /**
         * @description: 是否正常
         * @param {*}
         * @return {*}
         */        
        bool isNormally() override{
            return true;
        }
        // DESCRIPTION

    public:
        Timer::Ptr timer = nullptr;
    };

};




#endif