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

namespace FSI.BT.IR.Plc.Settings.Log.Models
{

    public class Organization
    {
        public Organization()
        {
            Parents = new HashSet<Organization>();
        }

        [Key]
        public int Id { get; set; }

        [StringLength(30)]
        public string Name { get; set; }

        [StringLength(10)]
        public string ShortName { get; set; }

        [StringLength(255)]
        public string? Description { get; set; }

        [ForeignKey(nameof(Id))]
        public int? ParentId { get; set; }

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

        [DisplayName("Type")]
        public OrganizationType Type { get; set; }

        public DateTime CreationTimeStamp { get; set; }

        public DateTime ModificationTimeStamp { get; set; }

        public string FullShortName { 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,
    }

}
