using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XYY.Service.Standard.Finance.Charging.Express
{
    /// <summary>
    /// 费用基类-Redis
    /// 以客户，渠道，国家 组合为索引
    /// 以生效时间为时间戳做排序查找
    /// </summary>
    public class ExpressFeeBase
    {
        public ExpressFeeBase(int customerId, int expressId, string country, DateTime DateTimeVersion, string body)
        {
            if (string.IsNullOrEmpty(country))
                throw new ArgumentException("国家不可为空");
            if (country.Length != 2)
                throw new ArgumentException("国家简码必须大于2位");
            if (expressId <= 0)
                throw new ArgumentException("必须填入渠道代码");
            if (DateTimeVersion == DateTime.MinValue)
                throw new ArgumentException("计费时间必须填入有效值");


            this.Key = "Fee" + customerId.ToString("00000") + expressId.ToString("00000") + country;
            this.DateTimeVersion = int.Parse(DateTimeVersion.ToString("yyyyMMdd"));
            this.FeeSetting = body;
        }
        /// <summary>
        /// 时间版本(天为单位)
        /// </summary>
        public long DateTimeVersion
        {
            get; set;
        }

        /// <summary>
        /// Key
        /// </summary>
        public string Key
        {
            get; set;
        }

        /// <summary>
        /// 费用明细
        /// </summary>
        public string FeeSetting
        {
            get; set;
        }
    }


}
