namespace NetinaShop.Domain.Entities.Discounts;

public partial class Discount
{
    public static Discount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count,bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,bool isSpecialOffer)
    {
        return new Discount(code, 
            discountPercent, 
            discountAmount, 
            hasCode, 
            amountType, 
            type, 
            count, 
            startDate,
            expireDate, 
            priceFloor, 
            hasPriceFloor, 
            priceCeiling, 
            hasPriceCeiling, 
            isInfinity, 
            useCount,
            isForInvitation,
            isSpecialOffer,
            immortal);
    }

    public bool IsExpired()
        => !Immortal && ExpireDate.Date < DateTime.Today.Date;

    public void SetCorporate(Guid userId)
    {
        IsForSaleCooperation = true;
        CorporateUserId = userId;
    }
}

public partial class ProductDiscount
{
    public static ProductDiscount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation ,bool isSpecialOffer, Guid productId)
    {
        return new ProductDiscount(code, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate,
            expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
            isForInvitation, isSpecialOffer, productId);
    }
}

public partial class CategoryDiscount
{
    public static CategoryDiscount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, bool isSpecialOffer, Guid categoryId)
    {
        return new CategoryDiscount(code, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate,
            expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
            isForInvitation,isSpecialOffer, categoryId);
    }
}
