using Hotline.Share.Dtos;
using Hotline.Share.Dtos.FlowEngine;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Dtos.Snapshot;
using Hotline.Snapshot;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hotline.Share.Dtos.FlowEngine.Workflow;

namespace Hotline.Application.Snapshot.Contracts;
public interface IOrderSnapshotApplication
{

    /// <summary>
    /// 随手拍公开审批详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<GetOrderSnapshotPublishAuditDetailOutDto> GetOrderSnapshotPublishAuditDetailAsync(string id);

    /// <summary>
    /// 添加公开工单
    /// </summary>
    /// <param name="addSnapshotOrderPublishInDto"></param>
    /// <param name="none"></param>
    /// <returns></returns>
    Task<string> AddOrderPublishAsync(AddSnapshotOrderPublishInDto addSnapshotOrderPublishInDto, CancellationToken none);

    /// <summary>
    /// 获取网格员回复集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<GuiderReplyItemsOutDto> GetGuiderReplyItems(GuiderReplyItemsInDto dto);

    /// <summary>
    /// 随手拍公开审批集合
    /// </summary>
    /// <returns></returns>
    ISugarQueryable<GetOrderSnapshotPublishAuditItemsOutDto> GetOrderSnapshotPublishAuditItems(GetOrderSnapshotPublishAuditItemsInDto dto);

    /// <summary>
    /// 随手拍公开详情
    /// </summary>
    /// <param name="id">工单Id</param>
    /// <returns></returns>
    Task<GetOrderSnapshotPublishDetailOutDto> GetOrderSnapshotPublishDetailAsync(string id);

    /// <summary>
    /// 随手拍公开集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<GetOrderSnapshotPublishItemsOutDto> GetOrderSnapshotPublishItems(GetOrderSnapshotPublishItemsInDto dto);

    /// <summary>
    /// 获取工单标签集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<SignOrderSnapshotItemsOutDto> GetSignOrderSnapshotItems(SignOrderSnapshotItemsInDto dto);

    /// <summary>
    /// 批量设置随手拍公开申请不通过
    /// </summary>
    /// <returns></returns>
    Task UpdateOrderSnapshotPublishsStatusRefuseAsync(IList<string> ids);

    /// <summary>
    /// 审核随手拍公开申请通过/不通过
    /// </summary>
    /// <returns></returns>
    Task UpdateOrderSnapshotPublishStatusAsync(UpdateOrderSnapshotPublishStatusInDto dto);

    /// <summary>
    /// 随手拍工单标签
    /// </summary>
    /// <param name="id"></param>
    /// <param name="snapshotLabels"></param>
    /// <returns></returns>
    Task UpdateLabelAsync(string id, IList<Kv>? snapshotLabels);

    /// <summary>
    /// 随手拍工单办理数据保存
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    Task SaveOrderWorkflowInfo(NextWorkflowDto<OrderHandleFlowDto> dto);

    /// <summary>
    /// 获取随手拍工单标签日志
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<LabelOrderSnapshotLogItemsOutDto> GetLabelOrderSnapshotLogItems(LabelOrderSnapshotLogItemsInDto dto);

    /// <summary>
    /// 返回办理页面基础数据
    /// </summary>
    /// <param name="rsp">isAqyh：是否属于安全隐患,hasInputed：是否已经输入过安全隐患相关字段)</param>
    /// <param name="orderId"></param>
    /// <returns></returns>
    Task<bool> GetNextStepsDatabaseAsync(NextStepsWithOpinionDto<RecommendStepOption> rsp, string orderId);

    /// <summary>
    /// 随手拍工单集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<OrderSnapshotItemsOutDto> GetOrderSnapshotItems(OrderSnapshotItemsInDto dto);

    /// <summary>
    /// 电气焊作业申请工单集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<OrderSnapshotElectrogasItemsOutDto> GetOrderSnapshotElectrogasItems(OrderSnapshotItemsInDto dto);

    /// <summary>
    /// 获取工单已经标签集合
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    ISugarQueryable<LabeledOrderSnapshotItemsOutDto> GetLabeledOrderSnapshotItems(LabeledOrderSnapshotItemsInDto dto);

    /// <summary>
    /// 工单标记
    /// </summary>
    /// <param name="orderId"></param>
    /// <param name="isSafetyDepartment"></param>
    /// <param name="remark"></param>
    /// <returns></returns>
    Task<OrderSnapshot> UpdateSafetyAsync(string orderId, bool isSafetyDepartment, string remark);
    ISugarQueryable<CitizenRewardOutDto> GetCitizenRewardItems(CitizenRewardInDto dto);

    /// <summary>
    /// 更新随手拍工单重办原因
    /// </summary>
    /// <param name="orderId"></param>
    /// <param name="firstErrorId"></param>
    Task UpdateSpecialReasonAsync(string orderId, string errorId, string errorName);
    Task UpdateIsEmphasisAsync(UpdateIsEmphasisInDto dto);

    Task GetOrderDetailAsync(string id, Share.Dtos.Order.OrderDto dto, CancellationToken token);
    Task<string> GetStartflowAsync(string? orderId, CancellationToken requestAborted);

    /// <summary>
    /// 更新工单
    /// </summary>
    /// <param name="dto"></param>
    /// <returns></returns>
    Task UpdateOrderAsync(UpdateOrderDto dto, CancellationToken token);
}
