using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FoodShop.Models
{
    public class Product
    {
        [Key, StringLength(32), Display(Name = "PartNumber")]
        public string Id { get; set; }

        [Display(Name = "Nome")]
        public string Name { get; set; }

        //[Required(ErrorMessage = "E' richiesto un Prezzo in Euro!")]
        [Display(Name = "Prezzo")]
        [Column(TypeName = "decimal(18,2)")]
        [DisplayFormat(DataFormatString = "{0:c}")]
        public decimal? Price { get; set; }

        [Display(Name = "Codice IVA"), StringLength(2)]
        public string TaxCodeId { get; set; }

        public int? PromoDiscount { get; set; }

        [DefaultValue("1 Pz"), StringLength(115)]
        public string QuantityPerUnit { get; set; }

        [Display(Name = "Descrizione")]
        public string Description { get; set; }

        [Display(Name = "Immagine")]
        public string Image { get; set; }

        [Display(Name = "Modificato il")]
        [Column(TypeName = "datetime2")]
        public DateTime? LastUpdated { get; set; }

        public int CategoryId { get; set; }

        public int ConditionId { get; set; }

        [DefaultValue(0)]
        public int? InStock { get; set; }

        [DefaultValue(0)]
        public int? InOrder { get; set; }

        [DefaultValue(false)]
        public bool? Unavailable { get; set; }

        [DefaultValue(0)]
        public int? MinimalInStock { get; set; }
        public int? SupplierId { get; set; }

        [Display(Name = "Voto")]
        [DefaultValue(1)]
        [Range(0, 5, ErrorMessage = "Inserire un valore di {0} da {1} a {2}!")]
        public int Quote { get; set; }

        public string Notes { get; set; }
        public int? ShippingWeight { get; set; }
        public int? ShippingLengthSum { get; set; }
    }

    public class Category
    {
        [Key, ScaffoldColumn(false)]
        public int Id { get; set; }

        [Display(Name = "Nome")]
        [Required(ErrorMessage = "E' richiesto la Categoria del Prodotto")]
        [MaxLength(69, ErrorMessage = "Il Nome la Categoria deve essere lungo massimo di 69 caratteri")]
        public string Name { get; set; }

        [Display(Name = "Immagine")]
        public string Image { get; set; }
    }

    public class ProductAlternate
    {
        [Key, ScaffoldColumn(false)]
        public int Id { get; set; }

        [StringLength(32), Display(Name = "PartNumber")]
        public string ProductId { get; set; }

        [StringLength(32), Display(Name = "Sostitutivo")]
        public string Alternate { get; set; }

    }

    public class TaxCode
    {
        [Required, Key, StringLength(2)]
        [Display(Name = "Codice IVA")]
        public string Id { get; set; }

        [Display(Name = "Nome")]
        [Required(ErrorMessage = "E' richiesto Il Nome del Codice di Tassazione")]
        [MaxLength(46, ErrorMessage = "Il Nome del Codice di Tassazione deve essere lungo massimo di 46 caratteri")]
        public string Name { get; set; }

        [Required]
        public int Percentuale { get; set; }
    }

    public class Supplier
    {
        [ScaffoldColumn(false)]
        [Required, Key]
        public int Id { get; set; }

        [Required, StringLength(146), Display(Name = "Nome")]
        public string SupplierName { get; set; }

        [StringLength(15), Display(Name = "Codice Fiscale")]
        public string Fcode { get; set; }

        [StringLength(15), Display(Name = "Partita IVA")]
        public string Piva { get; set; }

        [StringLength(92), Display(Name = "REA")]
        public string Rea { get; set; }

        [StringLength(256), Display(Name = "Indirizzo")]
        public string Address { get; set; }

        [StringLength(146), Display(Name = "Città")]
        public string City { get; set; }

        [StringLength(13), Display(Name = "CAP")]
        public string PostalCode { get; set; }

        [StringLength(3), Display(Name = "Prov.")]
        public string Country { get; set; }

        [StringLength(146), Display(Name = "Stato")]
        public string State { get; set; }

        [StringLength(256), Display(Name = "Telefono")]
        public string Phone { get; set; }

        [StringLength(256), Display(Name = "Email")]
        public string Email { get; set; }

        [Display(Name = "Descrizione")]
        public string Description { get; set; }

        public string Image { get; set; }
        public string WebSiteUrl { get; set; }
    }


}
