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

namespace FMSAdmin.Entities {
    public partial class BemsMonitoringPoint {
        public BemsMonitoringPoint() {
            BemsControlPointHistory = new HashSet<BemsControlPointHistory>();
            BemsMonitoringPointHistory15min = new HashSet<BemsMonitoringPointHistory15min>();
            BemsMonitoringPointHistory15minRawData = new HashSet<BemsMonitoringPointHistory15minRawData>();
            BemsMonitoringPointHistoryDaily = new HashSet<BemsMonitoringPointHistoryDaily>();
            BemsMonitoringPointHistoryHourly = new HashSet<BemsMonitoringPointHistoryHourly>();
            BemsMonitoringPointToAnlaysisType = new HashSet<BemsMonitoringPointToAnlaysisType>();
            FmsAlarmPoint = new HashSet<FmsAlarmPoint>();
        }

        //모니터링 관제점
        [Display(Name = "현장 고유번호"), Key]
        public int SiteId { get; set; }
        [Display(Name = "설비종류")]
        public int FacilityTypeId { get; set; }
        [Display(Name = "설비코드"), Key]
        public int FacilityCode { get; set; }
        [Display(Name = "설비속성고유번호"), Key]
        public int PropertyId { get; set; }
        [Display(Name = "값 형식")]
        public int ValueType { get; set; }
        [Display(Name = "관제점 용도")]
        public short? ServiceTypeId { get; set; }
        [Display(Name = "연료 고유번호")]
        public short? FuelTypeId { get; set; }
        [Display(Name = "관제점 이름")]
        [StringLength(64)]
        public string Name { get; set; }
        [Display(Name = "관제점 설명")]
        [StringLength(256)]
        public string Description { get; set; }
        [Display(Name = "빌딩 고유번호")]
        public int? BuildingId { get; set; }
        [Display(Name = "설치 위치(층)")]
        public int? FloorId { get; set; }
        [Display(Name = "설비 위치(존)")]
        public int? ZoneId { get; set; }

        [ForeignKey("SiteId,BuildingId")]
        public virtual CmBuilding CmBuilding { get; set; }
        [ForeignKey("SiteId,FacilityCode")]
        public virtual CmFacility CmFacility { get; set; }
        [ForeignKey("SiteId,BuildingId,FloorId")]
        public virtual CmFloor CmFloor { get; set; }
        [ForeignKey("SiteId,BuildingId,FloorId,ZoneId")]
        public virtual CmZone CmZone { get; set; }

        [ForeignKey("FacilityTypeId")]
        public virtual BemsFacilityType FacilityType { get; set; }

        [ForeignKey("ValueType")]
        public virtual BemsValueType ValType { get; set; }

        [ForeignKey("FuelTypeId")]
        public virtual BemsFuelType FuelType { get; set; }

        [ForeignKey("ServiceTypeId")]
        public virtual BemsServiceType ServiceType { get; set; }


        [JsonIgnore]
        [InverseProperty("BemsMonitoringPoint")]
        public virtual BemsMonitoringPointConfig BemsMonitoringPointConfig { get; set; }

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

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

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

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

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

        [JsonIgnore]
        [InverseProperty("BemsMonitoringPoint")]
        public virtual ICollection<BemsMonitoringPointToAnlaysisType> BemsMonitoringPointToAnlaysisType { get; set; }
        [InverseProperty("BemsMonitoringPoint")]
        public virtual ICollection<FmsAlarmPoint> FmsAlarmPoint { get; set; }
    }
}
