namespace ServiceCenter.Data.BLT
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using DataAnnotations = System.ComponentModel.DataAnnotations;

    using BLToolkit.Common;
    using BLToolkit.DataAccess;
    using BLToolkit.Mapping;

    /// <summary>
    /// Производитель
    /// </summary>
    [TableName("Manufacturer"), DisplayName("Производитель")]
    public class Manufacturer : EntityBase
    {
        /// <summary>
        /// Пустой конструктор для BLToolkit
        /// </summary>
        public Manufacturer()
        {

        }

        public Manufacturer(Manufacturer manufacturer)
        {
            this.Id = manufacturer.Id;
            this.Value = manufacturer.Value;
        }

        [MapField("ManufacturerId"), PrimaryKey, Identity, NonUpdatable, DisplayName("Id")]
        public int Id { get; set; }

        /// <summary>
        /// Наименование
        /// </summary>
        [NotNull, DisplayName("Наименование"), DataAnnotations.Required(ErrorMessage = "Наименование не может быть пустым"), DataAnnotations.DataType(DataAnnotations.DataType.Text), DataAnnotations.StringLength(50, ErrorMessage = "Максимум 50 символов")]
        public string Value { get; set; }

        /// <summary>
        /// Заявки
        /// </summary>
        [Association(CanBeNull = true, ThisKey = "Id", OtherKey = "ManufacturerId"), DisplayName("Заявки")]
        public List<Request> Requests { get; set; }
    }
}