import pygame
from controls.controlsbase import ControlsBase

class ControllerControls(ControlsBase):
    def __init__(self, joy):
        self.device = joy
        self.instance_id: int = self.device.get_instance_id()
        self.name = self.device.get_name()
        self.numaxis: int = self.device.get_numaxis()
        self.axis: list = []
        self.numhats: int = self.device.get_numhats()
        self.hats: list = []
        self.numbuttons: int = self.device.get_numbuttons()
        self.buttons: list = []
        self.power_level: str = ""
    
    def handle_input(self, event):
        pass
    
    def left(self):
        pass
    
    def right(self):
        pass
    
    def up(self):
        pass
    
    def down(self):
        pass
    
    def pause(self):
        pass
    
    def rumble(self):
        pass
    
    @property
    def name(self) -> str:
        return self._name
    
    @name.setter
    def name(self, name: str) -> None:
        self._name = name
    
    @property
    def axis(self) -> list:
        return self._axis
    
    @axis.setter
    def axis(self) -> None:
        self._axis = [self.device.get_axis(a) for a in range(self.numaxis)]
    
    @property
    def hats(self) -> list:
        return self._hats
    
    @hats.setter
    def hats(self) -> None:
        self.hats = [self.device.get_hats(h) for h in range(self.numhats)]
    
    @property
    def buttons(self) -> list:
        return self._buttons
    
    @buttons.setter
    def buttons(self) -> None:
        self._buttons = [self.device.get_buttons(b) for b in range(self.numbuttons)]
    
    @property
    def power_level(self) -> str:
        return self._power_level
    
    @power_level.setter
    def power_level(self) -> None:
        self._power_level = self.device.get_power_level()