import ctypes
from Grifo_E_1553lib.data_types.dl_target_validity import DlTargetValidity
from Grifo_E_1553lib.data_types.semicircle import Semicircle
from Grifo_E_1553lib.data_types.target_presentation_data import TargetPresentationData
from Grifo_E_1553lib.data_types.target_half_call_sign import TargetHalfCallSign
from Grifo_E_1553lib.data_types.target_position import TargetPosition

class Msg1DataLinkTarget(ctypes.Structure):
    _fields_ = [
        ("dl_target_validity", DlTargetValidity),
        ("tgt_01_pos_x", TargetPosition),
        ("tgt_01_pos_y", TargetPosition),
        ("tgt_01_ground_track_angle", Semicircle),
        ("tgt_01_presentation_data", TargetPresentationData),
        ("tgt_01_call_sign", TargetHalfCallSign * 2),
        ("tgt_02_pos_x", TargetPosition),
        ("tgt_02_pos_y", TargetPosition),
        ("tgt_02_ground_track_angle", Semicircle),
        ("tgt_02_presentation_data", TargetPresentationData),
        ("tgt_02_call_sign", TargetHalfCallSign * 2),
        ("tgt_03_pos_x", TargetPosition),
        ("tgt_03_pos_y", TargetPosition),
        ("tgt_03_ground_track_angle", Semicircle),
        ("tgt_03_presentation_data", TargetPresentationData),
        ("tgt_03_call_sign", TargetHalfCallSign * 2),
        ("tgt_04_pos_x", TargetPosition),
        ("tgt_04_pos_y", TargetPosition),
        ("tgt_04_ground_track_angle", Semicircle),
        ("tgt_04_presentation_data", TargetPresentationData),
        ("tgt_04_call_sign", TargetHalfCallSign * 2),
        ("tgt_05_pos_x", TargetPosition),
        ("tgt_05_pos_y", TargetPosition),
        ("tgt_05_ground_track_angle", Semicircle),
        ("tgt_05_presentation_data", TargetPresentationData),
        ("tgt_05_call_sign", TargetHalfCallSign * 2),
    ]

    def __init__(self):
        super().__init__()
        self.dl_target_validity = DlTargetValidity()
        self.tgt_01_pos_x = TargetPosition()
        self.tgt_01_pos_y = TargetPosition()
        self.tgt_01_ground_track_angle = Semicircle()
        self.tgt_01_presentation_data = TargetPresentationData()
        self.tgt_01_call_sign = (TargetHalfCallSign * 2)()  # Inizializza l'array
        self.tgt_02_pos_x = TargetPosition()
        self.tgt_02_pos_y = TargetPosition()
        self.tgt_02_ground_track_angle = Semicircle()
        self.tgt_02_presentation_data = TargetPresentationData()
        self.tgt_02_call_sign = (TargetHalfCallSign * 2)()  # Inizializza l'array
        self.tgt_03_pos_x = TargetPosition()
        self.tgt_03_pos_y = TargetPosition()
        self.tgt_03_ground_track_angle = Semicircle()
        self.tgt_03_presentation_data = TargetPresentationData()
        self.tgt_03_call_sign = (TargetHalfCallSign * 2)()  # Inizializza l'array
        self.tgt_04_pos_x = TargetPosition()
        self.tgt_04_pos_y = TargetPosition()
        self.tgt_04_ground_track_angle = Semicircle()
        self.tgt_04_presentation_data = TargetPresentationData()
        self.tgt_04_call_sign = (TargetHalfCallSign * 2)()  # Inizializza l'array
        self.tgt_05_pos_x = TargetPosition()
        self.tgt_05_pos_y = TargetPosition()
        self.tgt_05_ground_track_angle = Semicircle()
        self.tgt_05_presentation_data = TargetPresentationData()
        self.tgt_05_call_sign = (TargetHalfCallSign * 2)()  # Inizializza l'array