using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace FMSAdmin.Entities {
    public partial class FmsMaterialCodeClass {
        public FmsMaterialCodeClass() {
            this.FmsMaterialCodeClass1 = new HashSet<FmsMaterialCodeClass>();
            this.FmsMaterial = new HashSet<FmsMaterial>();
            this.FmsMaterial1 = new HashSet<FmsMaterial>();
            this.FmsMaterial2 = new HashSet<FmsMaterial>();
        }

        [Key]
        public int MaterialClassId { get; set; }
        public int? ParentMaterialClassId { get; set; }
        public int Depth { get; set; }
        [Required]
        [StringLength(32, ErrorMessage = "분류명은 최대 32자까지 입력 가능합니다.")]
        public string Name { get; set; }
        [StringLength(16)]
        public string Abbreviation { get; set; }
        public bool? IsUse { get; set; }

        [NotMapped]
        [Display(Name = "엑셀행번호")]
        public int ExcelRowNum { get; set; }

        [InverseProperty("FmsMaterialCodeClass2")]
        public virtual ICollection<FmsMaterialCodeClass> FmsMaterialCodeClass1 {
            get; set;
        }
        [ForeignKey("ParentMaterialClassId")]
        public virtual FmsMaterialCodeClass FmsMaterialCodeClass2 { get; set; }

        [JsonIgnore]
        [InverseProperty("FmsMaterialCodeClass")]
        public virtual ICollection<FmsMaterial> FmsMaterial { get; set; }
        [JsonIgnore]
        [InverseProperty("FmsMaterialCodeClass1")]
        public virtual ICollection<FmsMaterial> FmsMaterial1 { get; set; }
        [JsonIgnore]
        [InverseProperty("FmsMaterialCodeClass2")]
        public virtual ICollection<FmsMaterial> FmsMaterial2 { get; set; }
    }
}
