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

namespace FMSAdmin.Entities {
    public partial class FmsMaterialPurchaseRequest {
        public FmsMaterialPurchaseRequest() {
            FmsMaterialPurchaseOrder = new HashSet<FmsMaterialPurchaseOrder>();
            FmsMaterialPurchaseRequestMaterial = new HashSet<FmsMaterialPurchaseRequestMaterial>();
        }

        [Key]
        public int SiteId { get; set; }
        public int BusinessFieldId { get; set; }
        [Key]
        public int PurchaseRequestId { get; set; }
        public short PurchaseTypeId { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime RequestDate { get; set; }
        [Required]
        [StringLength(24)]
        public string RequestUserId { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? PurchaseHopeDate { get; set; }
        [Required]
        [StringLength(256)]
        public string Title { get; set; }
        [StringLength(2000)]
        public string Reason { get; set; }
        public short ProgressId { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? ApprovalDate { get; set; }
        [StringLength(24)]
        public string ApprovalUserId { get; set; }
        [Column("bSameOrder")]
        public bool? BSameOrder { get; set; }

        [ForeignKey("BusinessFieldId")]
        [InverseProperty("FmsMaterialPurchaseRequest")]
        public virtual CmBusinessField CmBusinessField { get; set; }
        [ForeignKey("ApprovalUserId")]
        [InverseProperty("FmsMaterialPurchaseRequestCmUser")]
        public virtual CmUser CmUser { get; set; }
        [ForeignKey("RequestUserId")]
        [InverseProperty("FmsMaterialPurchaseRequestCmUserNavigation")]
        public virtual CmUser CmUserNavigation { get; set; }
        [ForeignKey(nameof(ProgressId))]
        [InverseProperty(nameof(FmsMaterialCodeProgress.FmsMaterialPurchaseRequest))]
        public virtual FmsMaterialCodeProgress Progress { get; set; }
        [ForeignKey(nameof(PurchaseTypeId))]
        [InverseProperty(nameof(FmsMaterialCodePurchaseType.FmsMaterialPurchaseRequest))]
        public virtual FmsMaterialCodePurchaseType PurchaseType { get; set; }
        [ForeignKey(nameof(SiteId))]
        [InverseProperty(nameof(CmSite.FmsMaterialPurchaseRequest))]
        public virtual CmSite Site { get; set; }
        [InverseProperty("FmsMaterialPurchaseRequest")]
        public virtual ICollection<FmsMaterialPurchaseOrder> FmsMaterialPurchaseOrder { get; set; }
        [InverseProperty("FmsMaterialPurchaseRequest")]
        public virtual ICollection<FmsMaterialPurchaseRequestMaterial> FmsMaterialPurchaseRequestMaterial { get; set; }
    }
}
