using AyCode.Interfaces.Entities;
using AyCode.Interfaces.TimeStampInfo;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using TIAM.Core.Enums;
using TIAM.Entities.Drivers;
using TIAM.Entities.Products;
using TIAM.Entities.Users;

namespace TIAM.Entities.Transfers;

[Table(nameof(Transfer))]
public class Transfer: IEntityGuid, ITimeStampInfo, IProductForeignKey, IUserProductMappingRelation<Guid?>
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
    public Guid Id { get; set; }
    
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int OrderId { get; }

    public Guid ProductId { get; set; }
    public Guid? UserProductMappingId { get; set; }
    public Guid? UserProductToCarId { get; set; }

    public virtual UserProductMapping? UserProductMapping { get; set; }

    [Required] public TransferStatusType TransferStatusType { get; set; } = TransferStatusType.OrderSubmitted;

    [Required] public DateTime Appointment { get; set; }
    
    public bool Payed { get; set; }
    public double? Price { get; set; }
    public byte PassengerCount { get; set; }

    [MaxLength(50)] public string? FlightNumber { get; set; }
    [MaxLength(200)] public string FromAddress { get; set; }
    [MaxLength(200)] public string? ToAddress { get; set; }
    [MaxLength(250)] public string? Comment { get; set; }

    [Column("ReferralProductId")]
    public Guid? ReferralProductId { get; set; }

    public DateTime Created { get; set; }
    public DateTime Modified { get; set; }
}