# -*- coding: utf-8 -*-
from logging import Logger

import cfgtools
from messagebus import MessageBus
from messagehandler import MessageHandlerBuilder
from msgbus import MBEasyContext
from typing import List

from _ProxyMessageHandler import ProxyMessageHandler
from model import Kds


class NKDSCtrlMessageHandlerBuilder(MessageHandlerBuilder):
    def __init__(
        self,
        comp_name,    # type: str
        mb_context,   # type: MBEasyContext
        message_bus,  # type: MessageBus
        config,       # type: cfgtools.Group
        logger        # type: Logger
    ):
        # type: (...) -> None  # noqa

        self.comp_name = comp_name
        self.mb_context = mb_context
        self.message_bus = message_bus
        self.config = config
        self.logger = logger

        self.proxy = None

    def build_singletons(self):
        self.proxy = ProxyMessageHandler(
            self.comp_name,
            self.mb_context,
            self.message_bus,
            self.config,
            self.logger
        )

    def build_message_handler(self, message, event):
        return self.proxy

    def destroy_message_handler(self, message_handler):
        return

    def destroy_singletons(self):
        return
