using LinqToDB.Mapping;
using Azaion.Flights.Enums;

namespace Azaion.Flights.Database.Entities;

[Table("flights")]
public class Flight
{
    [PrimaryKey]
    [Column("id")]
    public Guid Id { get; set; }

    [Column("created_date")]
    public DateTime CreatedDate { get; set; }

    [Column("name")]
    public string Name { get; set; } = string.Empty;

    [Column("aircraft_id")]
    public Guid AircraftId { get; set; }

    [Association(ThisKey = nameof(AircraftId), OtherKey = nameof(Aircraft.Id))]
    public Aircraft? Aircraft { get; set; }

    [Association(ThisKey = nameof(Id), OtherKey = nameof(Waypoint.FlightId))]
    public List<Waypoint> Waypoints { get; set; } = [];
}
