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

namespace FMSAdmin.Entities {
    public partial class FmsContract {

        //계약 정보
        [Display(Name = "현장 고유번호"), Key]
        public int SiteId { get; set; }

        [Display(Name = "계약체결 고유번호"), Key]
        public int ContractId { get; set; }

        [Display(Name = "계약 명"), Required]
        [StringLength(256)]
        public string Name { get; set; }
        [Display(Name = "협력업체 유형")]
        public int? PartnerTypeId { get; set; }
        [Display(Name = "협력업체 고유번호")]
        public int? PartnerId { get; set; }
        [Display(Name = "계약 일시")]
        [Column(TypeName = "datetime")]
        public DateTime? ContractDate { get; set; }
        [Display(Name = "계약 시작일")]
        [Column(TypeName = "datetime")]
        public DateTime? StartDate { get; set; }
        [Display(Name = "계약 종료일")]
        [Column(TypeName = "datetime")]
        public DateTime? EndDate { get; set; }
        [Display(Name = "오너작업자")]
        [StringLength(24)]
        public string OwnerShipName { get; set; }
        [Display(Name = "담당자 전화번호")]
        [StringLength(20)]
        public string OwnerShipPhoneNo { get; set; }
        [Display(Name = "투입인원")]
        public short? CommitmentMan { get; set; }
        [Display(Name = "비고")]
        [StringLength(1024)]
        public string Comment { get; set; }
        [Display(Name = "근무형태")]
        public int? ContractClassId { get; set; }
        [Display(Name = "계약종류")]
        public int? ContractTypeId { get; set; }
        [Display(Name = "계약 방법 ID")]
        public int? ContractMethodId { get; set; }
        [Display(Name = "대금지급 유형")]
        public int? PaymentTypeId { get; set; }

        //2020-04-13 계약 테이블 컬럼 추가
        [Display(Name = "계약 금액(텍스트)")]
        [StringLength(100)]
        public string ContractAmountText { get; set; }
        [Display(Name = "계약 이행 보증률(%)")]
        public decimal ContractExeGuaranteeRate { get; set; }
        [Display(Name = "하자 보증률(%)  ")]
        public decimal DefectGuaranteeRate { get; set; }
        [Display(Name = "하자 보증기간(텍스트)")]
        [StringLength(50)]
        public string DefectGuaranteePeriodText { get; set; }
        [Display(Name = "파일 ID")]
        public int? FileId { get; set; }
        [ForeignKey("SiteId")]
        public virtual CmSite CmSite { get; set; }

        [ForeignKey("SiteId,PartnerId")]
        [InverseProperty("FmsContract")]
        public virtual CmPartner CmPartner { get; set; }

        [ForeignKey("PartnerTypeId")]
        [InverseProperty("FmsContract")]
        public virtual CmPartnerType PartnerType { get; set; }

        [ForeignKey("ContractClassId")]
        [InverseProperty("FmsContract")]
        public virtual FmsContractClass FmsContractClass { get; set; }

        [ForeignKey("ContractMethodId")]
        [InverseProperty("FmsContract")]
        public virtual FmsContractMethod FmsContractMethod { get; set; }

        [ForeignKey("ContractTypeId")]
        [InverseProperty("FmsContract")]
        public virtual FmsContractType FmsContractType { get; set; }

        [ForeignKey("PaymentTypeId")]
        [InverseProperty("FmsContract")]
        public virtual FmsPaymentType FmsPaymentType { get; set; }

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

    }
}
