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

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

        [Display(Name = "고유번호"), Key]
        public int SiteId { get; set; }
        public int AccidentId { get; set; }
        [Display(Name = "사고명"), Required]
        [StringLength(256)]
        public string Name { get; set; }
        [Display(Name = "사고 발생일")]
        [Column(TypeName = "datetime")]
        public DateTime? StartDate { get; set; }
        [Display(Name = "조치 완료일")]
        [Column(TypeName = "datetime")]
        public DateTime? EndDate { get; set; }
        [Display(Name = "종결일")]
        [Column(TypeName = "datetime")]
        public DateTime? ClosingDate { get; set; }
        [Display(Name = "사고 유형 고유번호")]
        public int AccidentTypeId { get; set; }
        [Display(Name = "부서 고유번호")]
        public int? DepartmentId { get; set; }
        [Display(Name = "최초목격자")]
        public string Firstwitness { get; set; }
        [Display(Name = "공사위치")]
        [StringLength(256)]
        public string AccidentLocation { get; set; }
        [Display(Name = "사고원인")]
        [StringLength(1024)]
        public string Reason { get; set; }
        [Display(Name = "조치내용")]
        [StringLength(1024)]
        public string Action { get; set; }
        [Display(Name = "조치내용")]
        [StringLength(1024)]
        public string Action2 { get; set; }
        [Display(Name = "피해내용")]
        [StringLength(1024)]
        public string Damage { get; set; }
        [Display(Name = "향후대책")]
        [StringLength(1024)]
        public string Measurement { get; set; }
        [Display(Name = "피해자이름")]
        public string VictimName { get; set; }
        [Display(Name = "피해자관계")]
        public string VictimRelation { get; set; }
        [Display(Name = "피해자연령")]
        public string VictimAge { get; set; }
        [Display(Name = "첨부화일1 ID")]
        public int? FileId1 { get; set; }
        [Display(Name = "첨부화일2 ID")]
        public int? FileId2 { get; set; }
        [Display(Name = "첨부화일3 ID")]
        public int? FileId3 { get; set; }
        [Display(Name = "첨부화일3 ID")]
        public int? FileId4 { get; set; }
        [Display(Name = "회사 고유번호")]
        public int? CompanyId { get; set; }
        [Display(Name = "보험처리여부")]
        public bool IsInsurance { get; set; }
        [Display(Name = "보험처리내용")]
        [StringLength(1024)]
        public string InsuranceContent { get; set; }

        [ForeignKey("SiteId")]
        public virtual CmSite CmSite { get; set; }

        [ForeignKey("SiteId,CompanyId")]
        public virtual CmCompany CmCompany { get; set; }

        [ForeignKey("SiteId,CompanyId,DepartmentId")]
        public virtual CmDepartment CmDepartment { get; set; }

        [ForeignKey("SiteId,FileId1")]
        public virtual CmFile CmFile1 { get; set; }
        [ForeignKey("SiteId,FileId2")]
        public virtual CmFile CmFile2 { get; set; }
        [ForeignKey("SiteId,FileId3")]
        public virtual CmFile CmFile3 { get; set; }
        [ForeignKey("SiteId,FileId4")]
        public virtual CmFile CmFile4 { get; set; }

        [ForeignKey("AccidentTypeId")]
        public virtual FmsAccidentCodeType FmsAccidentCodeType { get; set; }

        [InverseProperty("FmsAccident")]
        public virtual ICollection<FmsWorkRequestToAccident> FmsWorkRequestToAccident { get; set; }

    }
}
