

#include "MFSPublic.h"
#include "MediaF3Protocol.h"
#include <librdkafka/rdkafkacpp.h>

namespace mfs
{
class MediaF3Kafka
{
private:
    std::string m_brokers;//Broker列表，多个使用逗号分隔
    std::string m_topicStr;// Topic名称
    int m_partition;// 分区
    RdKafka::Conf* m_config;// Kafka Conf对象
    RdKafka::Conf* m_topicConfig;// Topic Conf对象
    RdKafka::Topic* m_topic;// Topic对象
    RdKafka::Producer* m_producer;// Producer对象
    RdKafka::DeliveryReportCb* m_dr_cb;
    RdKafka::EventCb* m_event_cb;
    RdKafka::PartitionerCb* m_partitioner_cb;
    
public:
    ~MediaF3Kafka();
    int init(const std::string& brokers, const std::string& topic, int partition);
    void pushMessage(const std::string& str, const std::string& key);

    
    // 9101
    static void PlayRealTime(const MessageBaseSetting& baseSetting, const std::string&  streamType, const std::string&  dataType, int port, const std::string& clientId, const std::string& monitorId);
    // 9102
    static void ControlRealTime(const MessageBaseSetting& baseSetting, const std::string& streamType, const std::string& closeVideoType,const std::string& control, const std::string& clientId, const std::string& monitorId);
    // 9201
    static void PlayPlayback(const MessageBaseSetting& baseSetting, const std::string& endTime, const std::string& startTime, const std::string& forwardOrRewind, const std::string& remoteMode, const std::string& streamType, const std::string& storageType, int port, const std::string& clientId, const std::string& monitorId);
    // 9202
    static void ControlPlayback(const MessageBaseSetting& baseSetting, const std::string& dragPlaybackTime, const std::string& forwardOrRewind,const std::string& remote, const std::string& clientId, const std::string& monitorId);

    static std::shared_ptr<MediaF3Kafka> Instance(const std::string& clientid);
};
}