from enum import Enum

from helix.constants.anchor_parts import OmgPowerGripParts, OmgPowerGripPlusParts, EcoFastenParts
from helix.constants.global_constants import system_force_capacity


class AnchorType(Enum):
    OMG_PowerGrip = 'OMG PowerGrip'
    OMG_PowerGrip_Plus = 'OMG PowerGrip Plus'
    EcoFasten = 'EcoFasten Eco 65'

    def uplift_capacity(self):
        return min(system_force_capacity, {AnchorType.OMG_PowerGrip: 305.,
                                           AnchorType.OMG_PowerGrip_Plus: 2000.,
                                           AnchorType.EcoFasten: 1343.}[self])

    def shear_capacity(self):
        return {AnchorType.OMG_PowerGrip: 142.,
                AnchorType.OMG_PowerGrip_Plus: 431.,
                AnchorType.EcoFasten: 1008.}[self]

    def parts(self):
        return {AnchorType.OMG_PowerGrip: OmgPowerGripParts(),
                AnchorType.OMG_PowerGrip_Plus: OmgPowerGripPlusParts(),
                AnchorType.EcoFasten: EcoFastenParts()}[self]

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