# Path: golem/core/logging/abs_logger.py
# class MessageLogger(ABC):
#     def __init__(self):
#         pass
# 
#     @abstractmethod
#     def log_user_message(self, dialog, time, state, message, type_, entities):
#         pass
# 
#     @abstractmethod
#     def log_bot_message(self, dialog, time, state, message):
#         pass
# 
#     def log_error(self, dialog, state, exception):
#         pass
# 
#     def log_user(self, dialog, chat_session):
#         pass


import logging
import requests
from golem.core.logging.abs_logger import MessageLogger
        from django.conf import settings
        from django.conf import settings




class ChatbaseLogger(MessageLogger):
    def __init__(self, api_key):
        super().__init__()
        self.base_url = 'https://chatbase.com/api'
        self.api_key = api_key
        if self.api_key is None:
            logging.warning("Chatbase API key not provided, will not log!")

    def _interface_to_platform(self, interface: str):
        if interface is None:
            return None
        return interface  # TODO

    def log_user_message(self, dialog, accepted_time, state, message: dict, type, entities):
        unsupported = False
        if '_unsupported' in entities and entities['unsupported']:
            unsupported = entities["_unsupported"][0].get('value', False)
        payload = {
            "api_key": self.api_key,
            "type": "user",
            "user_id": dialog.session.chat_id,

# Path: golem/core/logging/abs_logger.py
# class MessageLogger(ABC):
#     def __init__(self):
#         pass
# 
#     @abstractmethod
#     def log_user_message(self, dialog, time, state, message, type_, entities):
#         pass
# 
#     @abstractmethod
#     def log_bot_message(self, dialog, time, state, message):
#         pass
# 
#     def log_error(self, dialog, state, exception):
#         pass
# 
#     def log_user(self, dialog, chat_session):
#         pass


# Path: golem/core/logging/chatbase.py
import logging
import requests
from golem.core.logging.abs_logger import MessageLogger
        from django.conf import settings
        from django.conf import settings





class ChatbaseLogger(MessageLogger):
    def __init__(self, api_key):
        super().__init__()
        self.base_url = 'https://chatbase.com/api'
        self.api_key = api_key
        if self.api_key is None:
            logging.warning("Chatbase API key not provided, will not log!")

    def _interface_to_platform(self, interface: str):
        if interface is None:
            return None
        return interface  # TODO

    def log_user_message(self, dialog, accepted_time, state, message: dict, type, entities):
        unsupported = False
        if '_unsupported' in entities and entities['unsupported']:
            unsupported = entities["_unsupported"][0].get('value', False)
        payload = {
            "api_key": self.api_key,
            "type": "user",
            "user_id": dialog.session.chat_id,

            "time_stamp": int(accepted_time * 1000),