namespace EVCB_OCPP.Domain.Models.Database
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    /// <summary>
    /// 交易紀錄
    /// </summary>
    [Table("TransactionRecord")]
    public partial class TransactionRecord
    {
        public TransactionRecord()
        {
            StartIdTag = string.Empty;
            StopIdTag = string.Empty;
            StartTime = new DateTime(1991, 1, 1);
            StopTime = new DateTime(1991, 1, 1);
            ReservationId = -1;
            ReportedOn = new DateTime(1991, 1, 1);
            CreatedOn = new DateTime(1991, 1, 1);
            UpdatedOn = new DateTime(1991, 1, 1);
            StartTransactionReportedOn = new DateTime(1991, 1, 1);
            StopTransactionReportedOn = new DateTime(1991, 1, 1);
            ErrorMsg = string.Empty;
        }

        [Key]
        public Int64 Id { get; set; }

        /// <summary>
        /// 客戶代碼
        /// </summary>
        [Required]
        public Guid CustomerId { get; set; }
       


        /// <summary>
        /// 槍號  1 byte string、本來是 string、改為byte
        /// </summary>
        [Required]
        [Index("IX_1202_Issue_Report", Order = 2, IsUnique = true)]
        public byte ConnectorId { get; set; }


        /// <summary>
        /// TransactionId
        /// </summary>
        [Index("IX_TransactionId")]
        [Index("IX_1202_Issue_Report", Order = 3, IsUnique = true)]
        [Required]
        public int TransactionId { get; set; }



        /// <summary>
        /// chargePointSerialNumber
        /// </summary>
        [Index("IX_MachineId")]
        [Index("IX_1202_Issue_Report", Order = 1, IsUnique = true)]
        [Required]
        [StringLength(128)]
        public string ChargeBoxId { get; set; }

        /// <summary>
        /// StartIdTag
        /// </summary>
        [StringLength(20)]
        public string StartIdTag { get; set; }


        /// <summary>
        /// StopIdTag
        /// </summary>
        [StringLength(20)]
        public string StopIdTag { get; set; }

        /// <summary>
        /// 開始充電開始時間
        /// </summary>
        [Index("IX_1202_Issue_Report", Order = 4, IsUnique = true)]
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 充電結束時間
        /// </summary>
        public DateTime StopTime { get; set; }

        /// <summary>
        /// 預約Id
        /// </summary>
        public int ReservationId { set; get; }

        /// <summary>
        /// 停止原因No
        /// </summary>
        public int StopReasonId { set; get; }

        

        /// <summary>
        /// 開始meter
        /// </summary>
        [DataType("decimal(16 ,2")]
        public decimal MeterStart { get; set; }

        /// <summary>
        /// 結束meter
        /// </summary>
        [DataType("decimal(16 ,2")]
        public decimal MeterStop { get; set; }
      

      

        /// <summary>
        /// 回報時間
        /// </summary>
        public DateTime ReportedOn { get; set; }

        /// <summary>
        /// 產生時間
        /// </summary>
        public DateTime CreatedOn { get; set; }

        /// <summary>
        /// 更新時間
        /// </summary>
        public DateTime UpdatedOn { get; set; }
      

        /// <summary>
        /// 開始充電的回報時間
        /// </summary>
        public DateTime StartTransactionReportedOn { get; set; }

        /// <summary>
        /// 開始充電回報的次數
        /// </summary>
        public int RetryStartTransactionTimes { get; set; }

        /// <summary>
        /// 結束充電的回報時間
        /// </summary>
        public DateTime StopTransactionReportedOn { get; set; }

        /// <summary>
        /// 結束充電回報的次數
        /// </summary>
        public int RtryStopTransactionTimes { get; set; }

        /// <summary>
        /// 回調客戶API,問題紀錄
        /// </summary>
        public string ErrorMsg { set; get; }



    }
}