using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JiShe.CollectBus.Ammeters;
using JiShe.CollectBus.GatherItem;
using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Watermeter;
using Volo.Abp.Application.Services;

namespace JiShe.CollectBus.ScheduledMeterReading
{
    /// <summary>
    /// 定时任务基础约束
    /// </summary>
    public interface IScheduledMeterReadingService : IApplicationService
    {

        /// <summary>
        /// 获取采集项列表
        /// </summary>
        /// <returns></returns>
        Task<List<GatherItemInfo>> GetGatherItemByDataTypes();

        /// <summary>
        /// 构建待处理的下发指令任务处理
        /// </summary> 
        /// <returns></returns>
        Task CreateToBeIssueTasks();

        #region 电表采集处理
        /// <summary>
        /// 获取电表信息
        /// </summary>
        /// <param name="gatherCode">采集端Code</param>
        /// <returns></returns>
        Task<List<AmmeterInfo>> GetAmmeterInfoList(string gatherCode = "");

        /// <summary>
        /// 初始化电表缓存数据
        /// </summary>
        /// <param name="gatherCode">采集端Code</param>
        /// <returns></returns>
        Task InitAmmeterCacheData(string gatherCode = "");

        /// <summary>
        /// 1分钟采集电表数据，只获取任务数据下发，不构建任务
        /// </summary>
        /// <returns></returns>
        Task AmmeterScheduledMeterOneMinuteReading();

        /// <summary>
        /// 5分钟采集电表数据，只获取任务数据下发，不构建任务
        /// </summary>
        /// <returns></returns>
        Task AmmeterScheduledMeterFiveMinuteReading();

        /// <summary>
        /// 15分钟采集电表数据，只获取任务数据下发，不构建任务
        /// </summary>
        /// <returns></returns>
        Task AmmeterScheduledMeterFifteenMinuteReading();

        /// <summary>
        /// 获取电表阀控配置
        /// </summary>
        /// <param name="currentTime">阀控的时间</param>
        /// <returns></returns>
        Task<List<AmmeterAutoValveControlSetting>> GetAmmeterAutoValveControlSetting(string currentTime);

        /// <summary>
        /// 电表自动阀控
        /// </summary>
        /// <returns></returns>
        Task AmmeterScheduledAutoValveControl();

        /// <summary>
        /// 电表自动校时
        /// </summary>
        /// <param name="timeDensity">采集频率</param>
        /// <param name="ammeterInfo">电表信息</param>
        /// <param name="groupIndex">集中器所在分组</param>
        /// <param name="timestamps">采集频率对应的时间戳</param>
        /// <returns></returns>
        Task AmmeterScheduledAutomaticVerificationTime(int timeDensity, AmmeterInfo ammeterInfo, int groupIndex, DateTime timestamps);

        /// <summary>
        /// 日冻结抄读
        /// </summary>
        /// <param name="timeDensity">采集频率</param>
        /// <param name="ammeterInfo">电表信息</param>
        /// <param name="groupIndex">集中器所在分组</param>
        /// <param name="timestamps">采集频率对应的时间戳</param>
        /// <returns></returns>
        Task AmmeterScheduledGetAutomaticDayFreezeData(int timeDensity, AmmeterInfo ammeterInfo, int groupIndex, DateTime timestamps);

        /// <summary>
        /// 月冻结数据抄读
        /// </summary>
        /// <param name="timeDensity">采集频率</param>
        /// <param name="ammeterInfo">电表信息</param>
        /// <param name="groupIndex">集中器所在分组</param>
        /// <param name="timestamps">采集频率对应的时间戳</param>
        /// <returns></returns>
        Task AmmeterScheduledGetAutomaticMonthFreezeData(int timeDensity, AmmeterInfo ammeterInfo, int groupIndex, DateTime timestamps); 

        #endregion 

        #region 水表采集处理
        /// <summary>
        /// 获取水表信息
        /// </summary>
        /// <param name="gatherCode">采集端Code</param>
        /// <returns></returns>
        Task<List<WatermeterInfo>> GetWatermeterInfoList(string gatherCode = "");

        /// <summary>
        /// 初始化水表缓存数据，只获取任务数据下发，不构建任务
        /// </summary>
        /// <param name="gatherCode">采集端Code</param>
        /// <returns></returns>
        Task InitWatermeterCacheData(string gatherCode = "");

        /// <summary>
        /// 水表数据采集
        /// </summary>
        /// <returns></returns>
        Task WatermeterScheduledMeterAutoReadding();

        #endregion

        #region 集中器处理

        /// <summary>
        /// 自动获取终端版
        /// </summary>
        /// <param name="timeDensity">采集频率</param>
        /// <param name="ammeterInfo">电表信息</param>
        /// <param name="groupIndex">集中器所在分组</param>
        /// <param name="timestamps">采集频率对应的时间戳</param>
        /// <returns></returns>
        Task ConcentratorScheduledAutomaticGetTerminalVersion(int timeDensity, AmmeterInfo ammeterInfo, int groupIndex, DateTime timestamps);

        /// <summary>
        /// 自动获取远程通信模块(SIM)版本信息
        /// </summary>
        /// <param name="timeDensity">采集频率</param>
        /// <param name="ammeterInfo">电表信息</param>
        /// <param name="groupIndex">集中器所在分组</param>
        /// <param name="timestamps">采集频率对应的时间戳</param>
        /// <returns></returns>
        Task ConcentratorScheduledAutomaticGetTelematicsModule(int timeDensity, AmmeterInfo ammeterInfo, int groupIndex, DateTime timestamps);
        #endregion


    }
}
