using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace GreenTree.Strohrmann.ERP.Web.Models.Business
{
    public class TaxModel
    {
        #region Properties

        /// <summary>
        /// Tax id
        /// </summary>
        [Display(Name = "ID")]
        public int Id { get; set; }

        /// <summary>
        /// Tax name
        /// </summary>
        [Display(Name = "Name")]
        public string Name { get; set; }

        /// <summary>
        /// Tax short name
        /// </summary>
        [Display(Name = "Kurzname")]
        public string ShortName { get; set; }

        /// <summary>
        /// Tax percentage value
        /// </summary>
        [Display(Name = "Steuersatz (in %)")]
        public decimal Value { get; set; }

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of the TaxModel class
        /// </summary>
        public TaxModel() { }

        /// <summary>
        /// Initializes a new instance of the TaxModel class
        /// </summary>
        /// <param name="tax">Base tax entity.</param>
        public TaxModel(Core.Domain.Business.Tax tax)
        {
            if (tax == null) return;

            Id = tax.Id;
            Name = tax.Name;
            ShortName = tax.ShortName;
            Value = tax.Value;
        }

        #endregion

        #region Overrides

        /// <summary>
        /// Returns a string that represents the current object with its' short name
        /// </summary>
        public override string ToString()
        {
            return ShortName;
        }

        #endregion
    }
}
