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

namespace FMSAdmin.Entities {
    public partial class FmsMaterialWarehouse {
        public FmsMaterialWarehouse() {
            FmsEquipment = new HashSet<FmsEquipment>();
            FmsMaterial = new HashSet<FmsMaterial>();
            FmsMaterialStored = new HashSet<FmsMaterialStored>();
            FmsMaterialRelease = new HashSet<FmsMaterialRelease>();
        }

        [Display(Name = "현장 고유번호"), Key]
        public int SiteId { get; set; }

        [Display(Name = "업무분야")]
        public int BusinessFieldId { get; set; }
        [Display(Name = "보관 창고 고유번호"), Key]
        public int WarehouseId { get; set; }
        [Display(Name = "보관창고 명칭"), Required]
        [StringLength(48)]
        public string Name { get; set; }
        [Display(Name = "사용여부")]
        public bool IsUse { get; set; }
        [Display(Name = "빌딩 고유번호")]
        public int? BuildingId { get; set; }
        [Display(Name = "층 고유번호")]

        public int? FloorId { get; set; }
        [Display(Name = "구역 고유번호")]

        public int? ZoneId { get; set; }

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

        [ForeignKey("BusinessFieldId")]
        [InverseProperty("FmsMaterialWarehouse")]
        public virtual CmBusinessField CmBusinessField { get; set; }
        [ForeignKey(nameof(SiteId))]
        [InverseProperty(nameof(CmSite.FmsMaterialWarehouse))]
        public virtual CmSite Site { get; set; }
        [ForeignKey("SiteId,BuildingId")]
        public virtual CmBuilding CmBuilding { get; set; }
        [ForeignKey("SiteId,BuildingId,FloorId")]
        public virtual CmFloor CmFloor { get; set; }
        [ForeignKey("SiteId,BuildingId,FloorId,ZoneId")]
        public virtual CmZone CmZone { get; set; }

        [JsonIgnore]
        [InverseProperty("FmsMaterialWarehouse")]
        public virtual ICollection<FmsEquipment> FmsEquipment { get; set; }
        [JsonIgnore]
        [InverseProperty("FmsMaterialWarehouse")]
        public virtual ICollection<FmsMaterial> FmsMaterial { get; set; }
        [JsonIgnore]
        [InverseProperty("FmsMaterialWarehouse")]
        public virtual ICollection<FmsMaterialStored> FmsMaterialStored { get; set; }

        [JsonIgnore]
        [InverseProperty("FmsMaterialWarehouse")]
        public virtual ICollection<FmsMaterialRelease> FmsMaterialRelease { get; set; }
    }
}
