using NetinaShop.Domain.Entities.Accounting;

namespace NetinaShop.Domain.Entities.Orders;

[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
[GenerateMapper]

public partial class Order : ApiEntity
{
    public Order()
    {

    }
    public Order(
        string factorCode,
        double totalPrice,
        double deliveryPrice,
        double taxesPrice,
        double servicePrice,
        double packingPrice,
        double totalProductsPrice,
        double discountPrice,
        bool isPayed, 
        OrderStatus orderStatus, 
        DateTime doneAt, 
        DateTime orderAt, 
        int preparingMinute, 
        string discountCode, 
        Guid userId, 
        OrderPaymentMethod paymentMethod)
    {
        FactorCode = factorCode;
        TotalPrice = totalPrice;
        DeliveryPrice = deliveryPrice;
        TaxesPrice = taxesPrice;
        ServicePrice = servicePrice;
        PackingPrice = packingPrice;
        TotalProductsPrice = totalProductsPrice;
        DiscountPrice = discountPrice;
        IsPayed = isPayed;
        OrderStatus = orderStatus;
        DoneAt = doneAt;
        OrderAt = orderAt;
        PreparingMinute = preparingMinute;
        DiscountCode = discountCode;
        UserId = userId;
        PaymentMethod = paymentMethod;
    }

    public string FactorCode { get; internal set; } = string.Empty;
    public double TotalProductsPrice { get; internal set; }
    public double PackingPrice { get; internal set; }
    public double ServicePrice { get; internal set; }
    public double DeliveryPrice { get; internal set; }
    public double DiscountPrice { get; internal set; }
    public double DiscountCodePrice { get; internal set; }
    public double ProductDiscountPrice { get; internal set; }
    public double TaxesPrice { get; internal set; }
    public double TotalPrice { get; internal set; }
    public bool IsPayed { get; internal set; }
    public DateTime PayedAt { get; internal set; }
    public OrderPaymentMethod PaymentMethod { get; internal set; }
    public OrderStatus OrderStatus { get; internal set; }
    public DateTime DoneAt { get; internal set; }
    public DateTime OrderAt { get; internal set; }
    public int PreparingMinute { get; internal set; }
    public string DiscountCode { get; internal set; } = string.Empty;

    public Guid UserId { get; internal set; }
    public ApplicationUser? User { get; internal set; }

    public OrderDelivery? OrderDelivery { get; set; }

    public List<OrderProduct> OrderProducts { get; internal set; } = new();


    public List<Payment> Payments { get; internal set; } = new();
}