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

namespace FMSAdmin.Entities {
    public partial class FmsWorkSchedule {
        public FmsWorkSchedule() {
            FmsWorkRequest = new HashSet<FmsWorkRequest>();
            FmsWorkScheduleToFacility = new HashSet<FmsWorkScheduleToFacility>();
        }

        [Key]
        public int SiteId { get; set; }
        [Key]
        public int WorkScheduleId { get; set; }
        public int WorkTypeId { get; set; }
        public int BusinessFieldId { get; set; }
        [Required]
        [StringLength(100)]
        public string Name { get; set; }
        public int? InspectionAgencyId { get; set; }
        public int CycleSize { get; set; }
        public int CycleUnitId { get; set; }
        public int HolidayWorkTypeId { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime WorkDueDate { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? WorkExpireDate { get; set; }
        [Required]
        [StringLength(24)]
        public string UpdateUserId { get; set; }
        public bool IsUse { get; set; }
        public bool IsAutoOrder { get; set; }
        [StringLength(1024)]
        public string Content { get; set; }

        public int? WorkPartnerId { get; set; }
        public string WorkPartnerName { get; set; }
        public string WorkItem { get; set; }
        [Column(TypeName = "numeric(15, 0)")]
        public decimal? WorkPrice { get; set; }

        [Column(TypeName = "datetime")]
        public DateTime? WorkEndDate { get; set; }

        public int? FileId { get; set; }

        public bool IsNotProcess { get; set; }

        [ForeignKey("SiteId,FileId")]
        public virtual CmFile CmFile { get; set; }

        [ForeignKey("SiteId")]
        public virtual CmSite CmSite { get; set; }
        [ForeignKey("BusinessFieldId")]
        [InverseProperty("FmsWorkSchedule")]
        public virtual CmBusinessField CmBusinessField { get; set; }
        [ForeignKey("SiteId,InspectionAgencyId")]
        [InverseProperty("FmsWorkSchedule")]
        public virtual CmPartner CmPartner { get; set; }
        [ForeignKey("UpdateUserId")]
        [InverseProperty("FmsWorkSchedule")]
        public virtual CmUser CmUser { get; set; }
        [ForeignKey("SiteId,CycleUnitId")]
        [InverseProperty("FmsWorkSchedule")]
        public virtual FmsWorkCodeCycleUnit FmsWorkCodeCycleUnit { get; set; }
        [ForeignKey("SiteId,HolidayWorkTypeId")]
        [InverseProperty("FmsWorkSchedule")]
        public virtual FmsWorkCodeHolidayWorkType FmsWorkCodeHolidayWorkType { get; set; }
        [ForeignKey(nameof(WorkTypeId))]
        [InverseProperty(nameof(FmsWorkCodeType.FmsWorkSchedule))]
        public virtual FmsWorkCodeType WorkType { get; set; }
        [InverseProperty("FmsWorkSchedule")]
        public virtual ICollection<FmsWorkRequest> FmsWorkRequest { get; set; }
        [InverseProperty("FmsWorkSchedule")]
        public virtual ICollection<FmsWorkScheduleToFacility> FmsWorkScheduleToFacility { get; set; }
    }
}
