#!/usr/bin/env python3
"""
   utils.configuration.from_file.py file for the c3 buttons.
   This is the super class used from the other classes that fetches configurations from a file.
"""
import sys
from abc import ABC, abstractmethod

### LOCAL
try:
    from utils.configuration.app_logger import set_logger_from_config
except ImportError as e:
    print("Unable to import 'set_logger_from_dict' from 'utils.configuration.app_logger.py' file at 'utils.boxes.box_pin.py' file" )
    sys.exit(1)


class BoxPin(ABC):
    """ TODO
    """

    def __init__(self, name: str, configuration: object, box_name: str) -> None:

        self.configuration = configuration
        self.logger = set_logger_from_config(name=name, config=self.configuration)
        self.get_box_config(box_name)

    def get_box_config(self, box_name):
        self.logger.debug(f"get_box_config - box_name: {box_name}")

        self.box_name = box_name
        box_info = self.configuration.boxes.get(box_name)
        self.pin_button = box_info.get('pin_button')
        self.pin_led = box_info.get('pin_led')
        self.enabled_led=self.configuration.box_led_enabled

    @abstractmethod
    def set_pin_usage(self):
        pass

    @abstractmethod
    def activated(self):
        pass