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

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

        [Key]
        public int SiteId { get; set; }
        [Key]
        public int PatrolPlanId { get; set; }
        public int GroupId { get; set; }
        public int CourseId { get; set; }
        [Required]
        [StringLength(48)]
        public string Name { get; set; }
        [StringLength(1024)]
        public string PlanDesc { get; set; }
        [Column("term")]
        public int Term { get; set; }
        [Column("inDate", TypeName = "datetime")]
        public DateTime? InDate { get; set; }

        [ForeignKey("SiteId,CourseId")]
        [InverseProperty("CmPatrolPlan")]
        public virtual CmPatrolCourse CmPatrolCourse { get; set; }
        [ForeignKey("SiteId,GroupId")]
        [InverseProperty("CmPatrolPlan")]
        public virtual CmPatrolGroup CmPatrolGroup { get; set; }
        [ForeignKey(nameof(SiteId))]
        [InverseProperty(nameof(CmSite.CmPatrolPlan))]
        public virtual CmSite Site { get; set; }
        [InverseProperty("CmPatrolPlan")]
        public virtual ICollection<CmPatrolSchedule> CmPatrolSchedule { get; set; }
    }
}