import ctypes
from Grifo_E_1553lib.data_types.a4_validity_and_slew import A4ValidityAndSlew
from Grifo_E_1553lib.data_types.relative_timetag import RelativeTimetag
from Grifo_E_1553lib.data_types.semicircle import Semicircle
from Grifo_E_1553lib.data_types.acceleration import Acceleration
from Grifo_E_1553lib.data_types.tas import Tas, WindSpeed
from Grifo_E_1553lib.data_types.cas import Cas
from Grifo_E_1553lib.data_types.baro_altitude import BaroAltitude
from Grifo_E_1553lib.data_types.radio_altitude import RadioAltitude
from Grifo_E_1553lib.data_types.spoi_altitude import SpoiAltitude
from Grifo_E_1553lib.data_types.latlong import LatLong
from Grifo_E_1553lib.data_types.crs_slave_range import CrsSlaveRange
from Grifo_E_1553lib.data_types.crs_motion_x import CrsMotionX
from Grifo_E_1553lib.data_types.crs_motion_y import CrsMotionY

class MsgNavDataAndCursor(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("validity_and_slew", A4ValidityAndSlew),
        ("timetag", RelativeTimetag),
        ("true_heading", Semicircle),
        ("magnetic_heading", Semicircle),
        ("x_acceleration", Acceleration),
        ("y_acceleration", Acceleration),
        ("z_acceleration", Acceleration),
        ("true_air_speed", Tas),
        ("calibrated_air_speed", Cas),
        ("baro_altitude", BaroAltitude),
        ("corrected_baro_altitude", BaroAltitude),
        ("radio_altitude", RadioAltitude),
        ("spoi_baro_altitude", SpoiAltitude),
        ("clearance_plane_distance", ctypes.c_uint16),
        ("wind_direction", Semicircle),
        ("wind_speed", WindSpeed),
        ("az_antenna_demand", Semicircle),
        ("el_antenna_demand", Semicircle),
        ("acq_crs_x", CrsMotionX),
        ("acq_crs_y", CrsMotionY),
        ("acq_crs_rng", CrsSlaveRange),
        ("acq_crs_az", ctypes.c_int16),
        ("ppos_timetag", RelativeTimetag),
        ("ppos_lat", LatLong),
        ("ppos_lon", LatLong),
        ("spoi_lat", LatLong),
        ("spoi_lon", LatLong),
    ]

    def __init__(self):
        super().__init__()
        self.validity_and_slew = A4ValidityAndSlew()
        self.timetag = RelativeTimetag()
        self.true_heading = Semicircle()
        self.magnetic_heading = Semicircle()
        self.x_acceleration = Acceleration()
        self.y_acceleration = Acceleration()
        self.z_acceleration = Acceleration()
        self.true_air_speed = Tas()
        self.calibrated_air_speed = Cas()
        self.baro_altitude = BaroAltitude()
        self.corrected_baro_altitude = BaroAltitude()
        self.radio_altitude = RadioAltitude()
        self.spoi_baro_altitude = SpoiAltitude()
        self.clearance_plane_distance = ctypes.c_uint16(0)
        self.wind_direction = Semicircle()
        self.wind_speed = WindSpeed()
        self.az_antenna_demand = Semicircle()
        self.el_antenna_demand = Semicircle()
        self.acq_crs_x = CrsMotionX()
        self.acq_crs_y = CrsMotionY()
        self.acq_crs_rng = CrsSlaveRange()
        # self.acq_crs_az = Semicircle()
        self.ppos_timetag = RelativeTimetag()
        self.ppos_lat = LatLong()
        self.ppos_lon = LatLong()
        self.spoi_lat = LatLong()
        self.spoi_lon = LatLong()