using Hncore.Infrastructure.DDD;
using System;
using System.Collections.Generic;

namespace Hncore.Pass.Vpn.Domain
{
    public partial class ProductAccountEntity : EntityWithTime<int>, ITenant
    {      
        public int TenantId { get; set; }
        public int? UserId { get; set; }
        public int? ProductId { get; set; }
        public int? PackageId { get; set; }
        public string UserCode { get; set; }
        public string UserPhone { get; set; }
        public string ProductName { get; set; }      
        public string PackageName { get; set; }
        public int? AccountType { get; set; }
        public string Account { get; set; }
        public string Pwd { get; set; }
        public int ConnectCount { get; set; } = 0;
        public AccountStatus Status { get; set; } = AccountStatus.Normal;
        public AccountChargeStatus? ChargeStatus { get; set; } = AccountChargeStatus.Normal;        
        public DateTime? StartTime { get; set; }
        public DateTime? EndTime { get; set; }

        public string Remark { get; set; }

        public string RestTime
        {
            get
            {
                if (EndTime < DateTime.Now)
                    return "已过期";
                var bTime = StartTime > DateTime.Now ? StartTime : DateTime.Now;
                var time = (EndTime - bTime).Value;
                return time.ToString(@"d\天hh\时mm\分");
            }
        }
        public int RestDay
        {
            get
            {
                if (EndTime < DateTime.Now)
                    return 0;
                var bTime = StartTime > DateTime.Now ? StartTime : DateTime.Now;
                var time = (EndTime - bTime).Value;
                return time.Days;
            }
        }

        public string Raw { get; set; }
        public int agent_id {get; set;}
    }
}
