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

namespace FMSAdmin.Entities {
    public partial class BemsDevice {
        public BemsDevice() {
            BemsDeviceRunHistory = new HashSet<BemsDeviceRunHistory>();
            BemsDeviceRunHourlyCombine = new HashSet<BemsDeviceRunHourlyCombine>();
            BemsFaultDiagnosis = new HashSet<BemsFaultDiagnosis>();
            BemsMeasureHistory = new HashSet<BemsMeasureHistory>();
            BemsMeasureSchedulePoint = new HashSet<BemsMeasureSchedulePoint>();
        }

        [Display(Name = "현장고유번호"), Key]
        public int SiteId { get; set; }
        [Display(Name = "건물번호"), Key]
        public int BuildingId { get; set; }
        [Display(Name = "가동 설비고유번호"), Key]
        public int DeviceId { get; set; }
        [Display(Name = "가동 설비명"), Required]
        [StringLength(52)]
        public string Name { get; set; }
        [Display(Name = "설비별칭")]
        [StringLength(52)]
        public string Nickname { get; set; }
        [Display(Name = "설비운전타입"), Key]
        public int DeviceTypeId { get; set; }
        [Display(Name = "설치위치번호")]
        public int? ZoneId { get; set; }
        [Display(Name = "용량")]
        public double? Capacity { get; set; }
        [Display(Name = "시간당 생산칼로리")]
        public double? Calorie { get; set; }
        [Display(Name = "효율")]
        public double? Efficiency { get; set; }
        [Display(Name = "사용여부")]
        public bool? IsUse { get; set; }
        [Display(Name = "임계치")]
        public int? Threshold { get; set; }
        [Display(Name = "시설 고유 번호")]
        public int? FacilityCode { get; set; }
        [Display(Name = "")]
        public double? KCalN { get; set; }
        [Display(Name = "")]
        public double? KCalD { get; set; }

        [ForeignKey("SiteId,BuildingId,ZoneId")]
        public virtual BemsZone BemsZone { get; set; }
        [ForeignKey("SiteId,BuildingId")]
        public virtual CmBuilding CmBuilding { get; set; }
        [ForeignKey(nameof(DeviceTypeId))]
        public virtual BemsDeviceType DeviceType { get; set; }
        [InverseProperty("BemsDevice")]
        public virtual ICollection<BemsDeviceRunHistory> BemsDeviceRunHistory { get; set; }
        [InverseProperty("BemsDevice")]
        public virtual ICollection<BemsDeviceRunHourlyCombine> BemsDeviceRunHourlyCombine { get; set; }
        [InverseProperty("BemsDevice")]
        public virtual ICollection<BemsFaultDiagnosis> BemsFaultDiagnosis { get; set; }
        [InverseProperty("BemsDevice")]
        public virtual ICollection<BemsMeasureHistory> BemsMeasureHistory { get; set; }
        [InverseProperty("BemsDevice")]
        public virtual ICollection<BemsMeasureSchedulePoint> BemsMeasureSchedulePoint { get; set; }
    }
}
