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

namespace FSI.BT.IR.Organization.Db.Models
{
    public class Organization
    {
        [Key]
        public int Id { get; set; }

        [DisplayName("Bezeichnung")]
        [Required(ErrorMessage = "Pflichtfeld")]
        [StringLength(64)]
        public string Name { get; set; }

        [DisplayName("Kurzname")]
        [Required(ErrorMessage = "Pflichtfeld")]
        [StringLength(16)]
        public string ShortName { get; set; }

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

        [DisplayName("Übergeordnetes Objekt")]
        public int? ParentId { get; set; }

        [DisplayName("Typ")]
        [Required(ErrorMessage = "Pflichtfeld")]        
        public OrganizationType Type { get; set; }

        [DisplayName("Erstellungsdatum")]
        [Required(ErrorMessage = "Pflichtfeld")]
        public DateTime Created { get; set; }

        [DisplayName("Bearbeitungsdatum")]
        [Required(ErrorMessage = "Pflichtfeld")]
        public DateTime Updated { get; set; }

        [DisplayName("Bereich")]
        public string FullShortName { get; set; }


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

}
