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

namespace FSI.Prj.Mgt.Models
{
    public class Organization
    {
        [Key]
        public int Id { get; set; }

        [DisplayName("Name")]
        [Required(ErrorMessage = "Dieses Feld wird benötigt.")]
        public string Name { get; set; }

        [DisplayName("Kurzname")]
        [Required(ErrorMessage = "Dieses Feld wird benötigt.")]
        public string ShortName { get; set; }

        [DisplayName("Beschreibung")]        
        public string Description { get; set; }

        [ForeignKey("Id")]
        [DisplayName("übergeordnetes Element")]
        public int? ParentId { get; set; }

        public virtual Organization Parent { get; set; }
        public virtual List<Organization> Parents{ get; set; }

        [DisplayName("Type")]
        [Required(ErrorMessage = "Dieses Feld wird benötigt.")]
        public OrganizationType Type { get; set; }
    }

    public enum OrganizationType
    {
        [Display(Name = "Firma")]
        company,
        [Display(Name = "Werk")]
        factory,
        [Display(Name = "Bereich")]
        area,
        [Display(Name = "Anlage")]
        plant,
        [Display(Name = "Teilanlage")]
        subPlant,        
    }

}
