# Path: src/mission_report/constants.py
# GAME_CLASSES = (
#     'CAeroplaneFragment',
#     'CAerostat',
#     'CAerostatAI',
#     'CAIPoi',
#     'CAirfield',
#     'CAnimationOperator',
#     'CAttachedVehicle',
#     'CBallistics',
#     'CBanner',
#     'CBatchBallistics',
#     'CBatchExplosion',
#     'CBatchTrash',
#     'CBatchTrashAnimated',
#     'CBFManager',
#     'CBlocksArray',
#     'CBombSiteAim',
#     'CBot',
#     'CBotAimingHead',
#     'CBotCharacter',
#     'CBotController',
#     'CBotFieldController',
#     'CBotHead',
#     'CBotInputController',
#     'CCameraOperator',
#     'CCloudSky',
#     'CClusterBallistics',
#     'CCommanderInputController',
#     'CComplexTrigger',
#     'CCumulativeRocket',
#     'CDFMission',
#     'CDistantLOD',
#     'CDummyObject',
#     'CEjectionPlace',
#     'CEjectorController',
#     'CFlag',
#     'CFlareGun',
#     'CFlexRope',
#     'CForestBody',
#     'CGameChat',
#     'CGameMission',
#     'CInfluenceArea',
#     'CMouseControlCameraOperator',
#     'CParachute',
#     'CParachutedContainer',
#     'CParatroopersCreator',
#     'CPhysPlatformRadioTurretAI',
#     'CPlane',
#     'CPlaneAI',
#     'CPlaneInputController',
#     'CPlatformTank',
#     'CRobotCameraOperator',
#     'CRocket',
#     'CRopeNode',
#     'CRopeSeg',
#     'CSharedGroup',
#     'CShip',
#     'CShipAI',
#     'CSolidTrash',
#     'CSpotlight',
#     'CSpotter',
#     'CStaticBlock',
#     'CStaticEmitter',
#     'CStaticVehicle',
#     'CSubmarine',
#     'CTank',
#     'CTerrainArray',
#     'CTorpedo',
#     'CTrainAI',
#     'CTrainLocomotive',
#     'CTrainWagon',
#     'CTrash',
#     'CTrashAnimated',
#     'CTruck',
#     'CTurret',
#     'CTurretCamera',
#     'CTurretRadioAI',
#     'CTurretRadioAIInputController',
#     'CTurretRiffle',
#     'CVehicleAI',
#     'CVehicleExplosionTurret',
#     'CVehicleInputController',
#     'CVehicleRangefinderTurret',
#     'CVehicleRangefinderTurretAI',
#     'CVehicleRocketTurret',
#     'CVehicleRocketTurretAI',
#     'CVehicleTorpedoTurret',
#     'CVehicleTorpedoTurretAI',
#     'CVehicleTurret',
#     'CVehicleTurretAI',
#     'CVehicleTurretInputController',
#     'CVisorCamera',
#     'CWindsock',
#     'CWireRope',
# )


from ast import literal_eval
from datetime import datetime
from .constants import GAME_CLASSES
import functools
import re
import unicodedata

# начало движения танка
# T:36160 AType:22 PID:1684580 POS(223718.406, 10.337, 242309.250)
atype_22 = re.compile(r'^T:(?P<tik>\d+) AType:22 PID:(?P<tank_id>[-\d]+) POS\((?P<pos>.+)\)$')


atype_handlers = [
    atype_0, atype_1, atype_2, atype_3, atype_4, atype_5, atype_6, atype_7, atype_8, atype_9, atype_10, atype_11,
    atype_12, atype_13, atype_14, atype_15, atype_16, atype_17, atype_18, atype_19, atype_20, atype_21, atype_22,
]


re_pos = re.compile(r'[.\-\d]+,\s*[.\-\d]+,\s*[.\-\d]+')


def pos_handler(pos):
    """
    :type pos: str
    """
    if re_pos.match(pos.strip()):
        pos = tuple(map(float, pos.split(',')))
        return dict(zip(['x', 'y', 'z'], pos))
    else:
        return None


@functools.lru_cache(maxsize=1024)
def object_name_handler(type_):
    """
    :type type_: str
    """

# Path: src/mission_report/constants.py
# GAME_CLASSES = (
#     'CAeroplaneFragment',
#     'CAerostat',
#     'CAerostatAI',
#     'CAIPoi',
#     'CAirfield',
#     'CAnimationOperator',
#     'CAttachedVehicle',
#     'CBallistics',
#     'CBanner',
#     'CBatchBallistics',
#     'CBatchExplosion',
#     'CBatchTrash',
#     'CBatchTrashAnimated',
#     'CBFManager',
#     'CBlocksArray',
#     'CBombSiteAim',
#     'CBot',
#     'CBotAimingHead',
#     'CBotCharacter',
#     'CBotController',
#     'CBotFieldController',
#     'CBotHead',
#     'CBotInputController',
#     'CCameraOperator',
#     'CCloudSky',
#     'CClusterBallistics',
#     'CCommanderInputController',
#     'CComplexTrigger',
#     'CCumulativeRocket',
#     'CDFMission',
#     'CDistantLOD',
#     'CDummyObject',
#     'CEjectionPlace',
#     'CEjectorController',
#     'CFlag',
#     'CFlareGun',
#     'CFlexRope',
#     'CForestBody',
#     'CGameChat',
#     'CGameMission',
#     'CInfluenceArea',
#     'CMouseControlCameraOperator',
#     'CParachute',
#     'CParachutedContainer',
#     'CParatroopersCreator',
#     'CPhysPlatformRadioTurretAI',
#     'CPlane',
#     'CPlaneAI',
#     'CPlaneInputController',
#     'CPlatformTank',
#     'CRobotCameraOperator',
#     'CRocket',
#     'CRopeNode',
#     'CRopeSeg',
#     'CSharedGroup',
#     'CShip',
#     'CShipAI',
#     'CSolidTrash',
#     'CSpotlight',
#     'CSpotter',
#     'CStaticBlock',
#     'CStaticEmitter',
#     'CStaticVehicle',
#     'CSubmarine',
#     'CTank',
#     'CTerrainArray',
#     'CTorpedo',
#     'CTrainAI',
#     'CTrainLocomotive',
#     'CTrainWagon',
#     'CTrash',
#     'CTrashAnimated',
#     'CTruck',
#     'CTurret',
#     'CTurretCamera',
#     'CTurretRadioAI',
#     'CTurretRadioAIInputController',
#     'CTurretRiffle',
#     'CVehicleAI',
#     'CVehicleExplosionTurret',
#     'CVehicleInputController',
#     'CVehicleRangefinderTurret',
#     'CVehicleRangefinderTurretAI',
#     'CVehicleRocketTurret',
#     'CVehicleRocketTurretAI',
#     'CVehicleTorpedoTurret',
#     'CVehicleTorpedoTurretAI',
#     'CVehicleTurret',
#     'CVehicleTurretAI',
#     'CVehicleTurretInputController',
#     'CVisorCamera',
#     'CWindsock',
#     'CWireRope',
# )


# Path: src/mission_report/parse_mission_log_line.py
from ast import literal_eval
from datetime import datetime
from .constants import GAME_CLASSES
import functools
import re
import unicodedata

# начало движения танка
# T:36160 AType:22 PID:1684580 POS(223718.406, 10.337, 242309.250)
atype_22 = re.compile(r'^T:(?P<tik>\d+) AType:22 PID:(?P<tank_id>[-\d]+) POS\((?P<pos>.+)\)$')


atype_handlers = [
    atype_0, atype_1, atype_2, atype_3, atype_4, atype_5, atype_6, atype_7, atype_8, atype_9, atype_10, atype_11,
    atype_12, atype_13, atype_14, atype_15, atype_16, atype_17, atype_18, atype_19, atype_20, atype_21, atype_22,
]


re_pos = re.compile(r'[.\-\d]+,\s*[.\-\d]+,\s*[.\-\d]+')


def pos_handler(pos):
    """
    :type pos: str
    """
    if re_pos.match(pos.strip()):
        pos = tuple(map(float, pos.split(',')))
        return dict(zip(['x', 'y', 'z'], pos))
    else:
        return None


@functools.lru_cache(maxsize=1024)
def object_name_handler(type_):
    """
    :type type_: str
    """

    if type_.startswith(GAME_CLASSES):
