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

namespace FMSAdmin.Entities {
    public partial class FmsMaterialStored {
        public FmsMaterialStored() {
            FmsMaterialReleaseDetail = new HashSet<FmsMaterialReleaseDetail>();
        }

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

        [Display(Name = "입고일")]
        [Column(TypeName = "datetime")]
        public DateTime StoredDate { get; set; }
        [Display(Name = "구매주문 ID")]
        public int? PurchaseOrderId { get; set; }
        [Display(Name = "자재창고 고유번호")]
        public int WarehouseId { get; set; }
        [Display(Name = "자재")]
        public int MaterialId { get; set; }
        [Display(Name = "입고수량")]
        public int StoredCount { get; set; }
        [Display(Name = "출고연계 재고수량")]
        public int RemainStoredCount { get; set; }
        [Display(Name = "단위 가격")]
        public int UnitCost { get; set; }
        [Display(Name = "재고수량")]
        public int StockCount { get; set; }
        [Display(Name = "비고")]
        [StringLength(1024)]
        public string Note { get; set; }
        [Display(Name = "입고자 ID"), Required]
        [StringLength(24)]
        public string StoredUserId { get; set; }
        [Display(Name = "승인일")]
        [Column(TypeName = "datetime")]
        public DateTime? ApprovalDate { get; set; }
        [Display(Name = "승인자 ID ")]
        [StringLength(24)]
        public string ApprovalUserId { get; set; }
        [Display(Name = "승인 여부")]
        public bool IsApproval { get; set; }
        [Display(Name = "입고 장소")]
        [StringLength(100)]
        public string LocationInWarehouse { get; set; }

        [ForeignKey("BusinessFieldId")]
        [InverseProperty("FmsMaterialStored")]
        public virtual CmBusinessField CmBusinessField { get; set; }
        [ForeignKey("ApprovalUserId")]
        [InverseProperty("FmsMaterialStoredCmUser")]
        public virtual CmUser CmUser { get; set; }
        [ForeignKey("SiteId,MaterialId")]
        [InverseProperty("FmsMaterialStored")]
        public virtual FmsMaterial FmsMaterial { get; set; }
        [ForeignKey("SiteId,PurchaseOrderId")]
        [InverseProperty("FmsMaterialStored")]
        public virtual FmsMaterialPurchaseOrder FmsMaterialPurchaseOrder { get; set; }
        [ForeignKey("SiteId,WarehouseId")]
        [InverseProperty("FmsMaterialStored")]
        public virtual FmsMaterialWarehouse FmsMaterialWarehouse { get; set; }
        [ForeignKey("StoredUserId")]
        [InverseProperty("FmsMaterialStoredS")]
        public virtual CmUser S { get; set; }
        [ForeignKey(nameof(SiteId))]
        [InverseProperty(nameof(CmSite.FmsMaterialStored))]
        public virtual CmSite Site { get; set; }

        [InverseProperty("FmsMaterialStored")]
        public virtual ICollection<FmsMaterialReleaseDetail> FmsMaterialReleaseDetail { get; set; }

        [NotMapped]
        public virtual ICollection<FmsMaterialStored> MaterialStoredList { get; set; }
    }
}
