using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYY.Tool.TimingTask.jobs;

namespace XYY.Tool.QuotaReduction
{
    public static class JobConfig
    {
        #region 链接配置
        private static string host_9521 = "http://120.24.149.148:9521/api/";//120.24.149.148:9521
        private static string host_9513 = "http://120.24.149.148:9513/api/";
        private static string host_9518 = "http://120.24.149.148:9518/api/";
        private static string host_9503 = "http://120.24.149.148:9503/api/";
        private static string host_smp = "http://api.smp.xingyunyi.cn/";
        private static string host_9520 = "http://120.24.149.148:9520/api/";
#if DEBUG
        //host_9521= "http://localhost:9521/api/";
        //host_9518 = "http://localhost:9518/api/";
#endif
        #region QuotaReductionJob 取消授信
        public static string QuotaReductionJobApi => $"{host_9521}CustomerAccount/QuotaReduction";
        /// <summary>
        /// 重试次数，不含首次请求
        /// </summary>
        public static int QuotaReductionJobTryTime => 3;
        /// <summary>
        /// 时间间隔，毫秒
        /// </summary>
        public static int QuotaReductionJobTryTimeInterval => 300000;
        #endregion
        #region 消息发送请求
        public static string dingdingApi => "http://120.24.149.148:9505/WarningNotice/NoticeText";
        public static string weChatApi => "http://120.24.149.148:9505/WarningNotice/NoticeTextToUser";
        /// <summary>
        /// 重试次数，不含首次请求
        /// </summary>
        public static int dingdingTryTime => 3;
        /// <summary>
        /// 时间间隔，毫秒
        /// </summary>
        public static int dingdingTryTimeInterval => 300000;
        #endregion
        #region GenerateFirstBillsJob 生成帐单
        public static string GenerateFirstBillsJobApi => $"{host_9521}FiannceCustomerDeliveryBill/GenerateFirstBills";
        public static string AlertFreezeCustomerJobApi => $"{host_9513}Customer/AlertFreezeCustomer?days=18";
        public static string ReChargeJobApi => $"{host_9503}ExpressFee/Charges";

        public static string ReloadExecuteAsEmptyApi => $"{host_smp}FinanceTask/ReloadExecuteAsEmpty";

        /// <summary>
        /// 重试次数，不含首次请求
        /// </summary>
        public static int GenerateFirstBillsJobTryTime => 3;
        /// <summary>
        /// 时间间隔，毫秒
        /// </summary>
        public static int GenerateFirstBillsJobTryTimeInterval => 300000;
        #endregion
        #region PB相关
        public static string PBPostManifestAction => $"{host_9518}order/PostManifest";
        #endregion
        #region 燃油附加费同步
        public static string FedexSurchargesSyncApi => $"{host_9521}ExpressageThirdPartyData/FedexSurchargesSync";
        public static string DHLSurchargesSyncApi => $"{host_9521}ExpressageThirdPartyData/DHLSurchargesSync";
        #endregion
        #region 结算价自动生成客户报价文件
        public static string GenerateQuotationApi => $"{host_9521}ExpressBulkAdjustmentQuote/GenerateQuotation";
        //先按5个一批执行
        public static string GenerateCustomerFileApi => $"{host_9521}ExpressBulkAdjustmentQuote/GenerateCustomerFile?fileCount=5";
        public static string GenerateZipFileApi => $"{host_9521}ExpressBulkAdjustmentQuote/GenerateZipFile";
        #endregion
        #region 提单轨迹任务更新
        public static string Lading51TrackApi => $"{host_9520}BatchTracking/Lading51Track";//Lading51Track
        #endregion
        #endregion
        public static IJobDetail[] jobs
        {
            get
            {
                return new IJobDetail[]
                 {
                          JobBuilder.Create<QuotaReductionJob>().Build(),
                          JobBuilder.Create<GenerateFirstBillsJob>().Build(),
                          JobBuilder.Create<AlertFreezeCustomerJob>().Build(),
                          JobBuilder.Create<PBPostManifestJob>().Build(),
                          JobBuilder.Create<RetryChargeJob>().Build(),
                          JobBuilder.Create<FuelSurchargeJob>().Build(),
                          //报价文件任务 start
                          JobBuilder.Create<GenerateCustomerQuotationJob>().Build(),
                           JobBuilder.Create<GenerateCustomerFileJob>().Build(),
                            JobBuilder.Create<GenerateZipFileJob>().Build(),
                              //报价文件任务 end
                            JobBuilder.Create<ReloadExecuteAsEmptyJob>().Build(),
                            JobBuilder.Create<SendOnlineOutTimeJob>().Build(),
                          JobBuilder.Create<Lading51TrackJob>().Build(),
                          JobBuilder.Create<FustGoTrackingJob>().Build(),
                          
                 };
            }
        }

        public static string[] crons
        {
            get
            {
                return new string[]
                {
                    //"0 0/2 * * * ?",//每1分钟执行，测试用
                    "0 0 0 */1 * ?",//每天零点执行
                    "0 0 0 */1 * ?",//每天零点执行
                    "0 0 9 * * ?",//每天9点执行
                    "0 0 0 */1 * ?",//每天零点执行
                    "0 0 2 * * ?",//每天2点执行
                    "0 0 5 * * ?",//每天5点执行
                   "0 0/3 * * * ?",//每3分钟执行
                   "0 0/10 * * * ?",//每10分钟执行
                   "0 0/20 * * * ?",//每20分钟执行
                    "0 0 5 * * ?",//每天5点执行
                    "0 0 5 * * ?",//每天9点执行
                     "0 0/30 * * * ?",//每30分钟执行
                     //"0 0 */1 * * ?",//每1小时执行
                     "0 0 0/1 * * ? ",
                };
            }
        }
    }
}
