using System.ComponentModel.DataAnnotations.Schema;
using NetinaShop.Domain.Entities.ProductCategories;

namespace NetinaShop.Domain.Entities.Products;
[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)]
//[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
[GenerateMapper]
public partial class Product : ApiEntity
{
    public Product()
    {

    }

    public Product(string persianName,
        string englishName,
        string summery,
        string expertCheck,
        string tags,
        string warranty,
        bool beDisplayed,
        double cost,
        double packingCost, 
        int stock,
        bool hasExpressDelivery,
        int maxOrderCount,
        bool isEnable,
        Guid brandId,
        Guid categoryId)
    {
        PersianName = persianName;
        EnglishName = englishName;
        Summery = summery;
        ExpertCheck = expertCheck;
        Tags = tags;
        Warranty = warranty;
        BeDisplayed = beDisplayed;
        Cost = cost;
        PackingCost = packingCost;
        Stock = stock;
        HasExpressDelivery = hasExpressDelivery;
        MaxOrderCount = maxOrderCount;
        IsEnable = isEnable;
        BrandId = brandId;
        CategoryId = categoryId;
    }
    public string PersianName { get; internal set; } = string.Empty;
    public string EnglishName { get; internal set; } = string.Empty;
    public string Summery { get; internal set; } = string.Empty;
    public string ExpertCheck { get; internal set; } = string.Empty;
    public string Tags { get; internal set; } = string.Empty;
    public string Warranty { get; internal set; } = string.Empty;
    public double Cost { get; internal set; }
    public bool IsEnable { get; internal set; }
    public bool BeDisplayed { get; internal set; }
    public double PackingCost { get; internal set; }
    public int Stock { get; internal set; }
    public float Rate { get; internal set; }
    public int ReviewCount { get; internal set; }
    public int Viewed { get; internal set; }
    public bool HasExpressDelivery { get; internal set; }
    public int MaxOrderCount { get; internal set; }

    public Guid BrandId { get; internal set; }
    public Brand? Brand { get; internal set; }
    
    public Guid CategoryId { get; internal set; }
    public ProductCategory? Category { get; internal set; }

    public List<Specification> Specifications { get; internal set; } = new();
    public List<Review> Reviews { get; internal set; } = new();
    public List<ProductStorageFile> Files { get; internal set; } = new();

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