import ctypes
from Grifo_E_1553lib.data_types.enums import Accuracy, NormalizationFactor, NormalizationFactor2
import Grifo_E_1553lib.data_types.enum_map as em
em.ENUM_MAP.update({
    "position_accuracy" : Accuracy,
    "velocity_accuracy" : Accuracy,
    "acceleration_accuracy" : Accuracy,
    "normalization_factor_for_target_position_x" : NormalizationFactor,
    "normalization_factor_for_target_position_y" : NormalizationFactor,
    "normalization_factor_for_target_position_z" : NormalizationFactor2
    
})

class TrackValidityAndStatusWord1(ctypes.LittleEndianStructure):
    _pack_ = 1
    _fields_ = [
        ("spare", ctypes.c_uint16, 1),
        ("acceleration_accuracy", ctypes.c_uint16, 2),
        ("velocity_accuracy", ctypes.c_uint16, 2),
        ("position_accuracy", ctypes.c_uint16, 2),
        ("display_coordinates_validity", ctypes.c_uint16, 1),
        ("spare", ctypes.c_uint16, 1),
        ("cas_and_mach_number_validity", ctypes.c_uint16, 1),
        ("aspect_angle_validity", ctypes.c_uint16, 1),
        ("acceleration_data_validity", ctypes.c_uint16, 1),
        ("velocity_data_validity", ctypes.c_uint16, 1),
        ("range_rate_validity", ctypes.c_uint16, 1),
        ("position_xyz_validity", ctypes.c_uint16, 1),
        ("range_validity", ctypes.c_uint16, 1),
    ]
class TrackValidityAndStatusWord2(ctypes.LittleEndianStructure):
    _pack_ = 1
    _fields_ = [
        ("spare", ctypes.c_uint16, 4),
        ("normalization_factor_for_target_position_z", ctypes.c_uint16, 2),
        ("normalization_factor_for_target_position_y", ctypes.c_uint16, 3),
        ("normalization_factor_for_target_position_x", ctypes.c_uint16, 3),
        ("aoj", ctypes.c_uint16, 1),
        ("hoj", ctypes.c_uint16, 1),
        ("target_in_coast", ctypes.c_uint16, 1),
        ("reacquisition", ctypes.c_uint16, 1),
    ]



    
