using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using wpf_connection3;

namespace wpf_connection3
{


    public class Product
    {
        public int ID { get; set; }
        public required string Title { get; set; }
        public string? Image { get; set; }
        public int ProductTypeID { get; set; }
        public required string ProductTypeTitle { get; set; }
        public required string ArticleNumber { get; set; }
        public double? MaterialCost { get; set; }
        public string? MaterialString { get; set; }
        public Uri? ImageBitmap
        {
            get
            {
                var imageName = Environment.CurrentDirectory + (Image ?? "");
                return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
            }
        }
        public int? LastMonthSaleQuantity { get; set; }
        public decimal MinCostForAgent {  get; set; }
        public string BackgroundColor
        {
            get
            {
                // возвращаем цвет, в зависимости от количества продаж 
                if (LastMonthSaleQuantity == null || LastMonthSaleQuantity == 0) return "#E75480"; // не белый
                return "#71bc78"; // не розовый
            }
        }
    }
}

