from enum import Enum
from helix.constants.module_type import ModuleType
from helix.constants.module_type_constants.dual_tilt_128_cell_constants import DualTilt128CellConstants
from helix.constants.module_type_constants.dual_tilt_96_cell_constants import DualTilt96CellConstants

from helix.constants.dual_tilt_parts import DualTiltParts
from helix.constants.module_type_constants.dual_tilt_pseries_constants import DualTiltPSeriesConstants
from helix.constants.module_type_constants.single_tilt_128_cell_constants import SingleTilt128CellConstants
from helix.constants.module_type_constants.single_tilt_96_cell_constants import SingleTilt96CellConstants
from helix.constants.module_type_constants.single_tilt_pseries_constants import SingleTiltPSeriesConstants
from helix.constants.single_tilt_parts import SingleTiltParts
from helix.constants.system_type_constants.dual_tilt_constants import DualTiltConstants
from helix.constants.system_type_constants.single_tilt_constants import SingleTiltConstants


class SystemType(Enum):
    singleTilt = '0'
    dualTilt = '1'

    def system_constants(self):
        return {
            SystemType.singleTilt: SingleTiltConstants(),
            SystemType.dualTilt: DualTiltConstants()
        }[self]

    def module_constants(self, module_type):
        return {
            SystemType.singleTilt: self.single_tilt_constants(module_type),
            SystemType.dualTilt: self.dual_tilt_constants(module_type)
        }[self]

    def parts(self, module_type):
        return {
            SystemType.singleTilt: SingleTiltParts(module_type),
            SystemType.dualTilt: DualTiltParts(module_type)
        }[self]

    def display_name(self):
        return {
            SystemType.singleTilt: 'Single-Tilt',
            SystemType.dualTilt: 'Dual-Tilt'
        }[self]

    @classmethod
    def default_value(cls):
        return cls.dualTilt.value

    def single_tilt_constants(self, module_type):
        return {
            ModuleType.Cell96: SingleTilt96CellConstants(),
            ModuleType.Cell128: SingleTilt128CellConstants(),
            ModuleType.PSeries: SingleTiltPSeriesConstants()
        }[module_type]

    def dual_tilt_constants(self, module_type):
        return {
            ModuleType.Cell96: DualTilt96CellConstants(),
            ModuleType.Cell128: DualTilt128CellConstants(),
            ModuleType.PSeries: DualTiltPSeriesConstants()
        }[module_type]
