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

namespace HellCoders.Entity
{
	class Product : Interface.IProduct
	{
		public int id { get; set; }
		public string code { get; set; }
		public string name { get; set; }
		public string brand { get; set; }
		public decimal price { get; set; }
		public decimal vat { get; set; }
		public decimal priceVat { get; set; }

		public string toCsvRow()
		{
			string[] arr = new string[7];
			arr[0] = this.id.ToString();
			arr[1] = this.code;
			arr[2] = this.name;
			arr[3] = this.brand;
			arr[4] = this.price.ToString();
			arr[5]= this.vat.ToString();
			arr[6] = this.priceVat.ToString();
			return string.Join(";",arr);
		}

        public bool Equals(Interface.IProduct other)
        {
            return other != null && this.id == other.id;
        }
        public override bool Equals(object obj)
        {
            return this.Equals(obj as Interface.IProduct);
        }
        public override int GetHashCode()
        {
            return this.id.GetHashCode();
        } 
    }
}
