from helix.constants.module_type import ModuleType
from helix.constants.parts import *


class DualTiltParts(object):
    east_west_panel_parts = {
        dual_tilt_chassis: 1,
        module: 2
    }

    center_panel_parts = {
        dual_tilt_chassis: 1,
        module: 2
    }

    sub_array_parts = {
        leading_tray: 1
    }

    def __init__(self, module_type):
        self.corner_panel_parts = {
            left_deflector_1_1: 1,
            right_deflector_1_1: 1,
            dual_tilt_chassis: 1.5,
            module: 2
        }
        self.north_south_panel_parts = {
            left_deflector_1_1: 1,
            right_deflector_1_1: 1,
            dual_tilt_chassis: 1.5,
            module: 2
        }

    def row_parts(self, module_type):
        if module_type == ModuleType.Cell96:
            front_skirt_parts = front_skirt
        else:
            front_skirt_parts = front_skirt_1_1
        return {
            front_skirt_parts: 2,
            leading_tray: 1
        }

    def column_parts(self, _):
        return {}

    def parts_per_panel_type(self):
        return [
            self.corner_panel_parts,
            self.north_south_panel_parts,
            self.east_west_panel_parts,
            self.center_panel_parts
        ]

    def dependent_parts(self, _):
        return {
            module: {
                wire_clip: 2,
                rubber_foot: 0.1
            },
            dual_tilt_chassis: {
                dual_tilt_platform: 1,
                platform_bolt: 4
            }
        }

    def fudge_factors(self, used_fallback):
        if used_fallback:
            return {
                dual_tilt_chassis: 1.04,
                leading_tray: 1.05
            }
        return {
            dual_tilt_chassis: 1.04,
        }
