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


class SingleTiltParts(object):
    center_panel_parts = {
        module: 1,
        single_tilt_chassis: 1
    }

    sub_array_parts = {
        leading_tray: 1
    }

    north_south_panel_parts = {
        module: 1,
        single_tilt_chassis: 0.5,
    }

    def __init__(self, module_type):
        self.corner_panel_parts = {
            module: 1,
            single_tilt_chassis: 1,
            left_deflector_1_1: 0.5,
            right_deflector_1_1: 0.5,
        }
        self.east_west_panel_parts = {
            module: 1,
            single_tilt_chassis: 1.5,
            left_deflector_1_1: 0.5,
            right_deflector_1_1: 0.5
        }


    def row_parts(self, _):
        return {}

    def column_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: 1,
            leading_tray: 1
        }

    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 module(self, module_type):
        if module_type == ModuleType.Cell96:
            rear_skirt_parts = rear_skirt_1_1
            spoiler_parts = spoiler
        else:
            rear_skirt_parts = rear_skirt_1_1
            spoiler_parts = spoiler_1_1
        return {
            spoiler_parts: 1,
            rear_skirt_parts: 1,
            wire_clip: 2,
            rubber_foot: 0.1
        }

    def dependent_parts(self, module_type):
        return {
            module: self.module(module_type),
            leading_tray: {
                following_tray: 1
            }
        }

    def fudge_factors(self, _):
        return {
            single_tilt_chassis: 1.0525
        }
