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

namespace UP_Session1_Belov.Models
{
    internal class ProductModel
    {
        private string id;
        private string name;
        private string description;
        private string manufacturer;
        private double cost;
        private double discount;
        private string image;
        private double costWithDiscount;
        private int count;

        public ProductModel(string id, string name, string description, string manufacturer, double cost, double discount, string image)
        {
            this.id = id;
            this.name = name;
            this.description = description;
            this.manufacturer = manufacturer;
            this.cost = cost;
            this.discount = discount;
            this.image = image;
            costWithDiscount = cost - ((cost * discount) / 100);
            count = 0;
        }
        public ProductModel(Product item)
        {
            id = item.ProductArticleNumber;
            name = item.ProductName;
            description = item.ProductDescription;
            manufacturer = item.Manufacturer.ManufacturerName;
            cost = Convert.ToDouble(item.ProductCost);
            discount = Convert.ToDouble(item.ProductDiscountAmount);
            image = item.ProductPhoto;
            costWithDiscount = cost - ((cost * discount) / 100);
            count = 0;
        }

        public string Id { get => id; set => id = value; }
        public string Name { get => name; set => name = value; }
        public string Description { get => description; set => description = value; }
        public string Manufacturer { get => manufacturer; set => manufacturer = value; }
        public double Cost { get => cost; set => cost = value; }
        public double Discount { get => discount; set => discount = value; }
        public string Image
        {
            get
            {
                if (image == null) return "zaglushka.png";
                else return image;
            }
            set => image = value;
        }

        public double CostWithDiscount { get => costWithDiscount; set => costWithDiscount = value; }
        public int Count { get => count; set => count = value; }
    }
}
