package com.yiqi.order.service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yiqi.app.domain.dto.AppDeliveryManListQueryDTO;
import com.yiqi.common.core.domain.PageVO;
import com.yiqi.common.core.domain.R;
import com.yiqi.core.domain.vo.ClothHangerOrderRelationVO;
import com.yiqi.order.domain.OrderCloth;
import com.yiqi.order.domain.OrderClothItem;
import com.yiqi.order.domain.dto.*;
import com.yiqi.order.domain.dto.weapp.OrderClothAppQueryDTO;
import com.yiqi.order.domain.vo.*;

/**
 * 洗衣订单Service接口
 *
 * @author ruoyi
 * @date 2023-10-06
 */
public interface IOrderClothService extends IService<OrderCloth> {

    public void handleDeliverySuccessUpdateOrderStatus(String orderNo);

    public R paySuccess(String orderNo, String outTradeNo);

    public R payExpireOrCancelNotify(String orderNo);

    public R refundSuccess(String refundNo, String orderNo);

    public R refundClosed(String orderNo);

    public R refundError(String orderNo);

    public R<Page<OrderClothQueryVO>> findPage(LambdaQueryWrapper<OrderCloth> queryWrapper, PageVO pageVO);

    public List<OrderClothVO> findPage(OrderClothAppQueryDTO orderClothAppQueryDTO);

    public OrderCloth collectCloth(OrderClothDTO orderClothDTO) throws Exception;

    /**
     * 计算配送费金额
     * @param orderId
     * @param sendWay
     * @return
     */
    public Map<String, Object> calculateDeliveryFee(Long orderId, String sendWay);


    public void refundOrderApply(Long orderId, String remark);

    /**
     * 衣服退款申请
     * @param remark
     */
    public void refundOrderItemApply(OrderClothItem orderClothItem, String remark);

    /**
     * 根据订单号获取订单信息
     *
     * @param orderNo
     * @return
     */
    OrderCloth getOrderClothByOrderNo(String orderNo);

    /**
     * 支付订单
     * @param orderClothAppPayDTO
     * @return
     */
    OrderPayResultVO clothOrderAppPay(OrderClothAppPayDTO orderClothAppPayDTO);

    /**
     * 创建洗衣订单支付
     *
     * @param orderClothPayDTO
     * @return
     */
    OrderPayResultVO clothOrderPay(OrderClothPayDTO orderClothPayDTO);

    /**
     * 查询洗衣订单
     *
     * @param id 洗衣订单主键
     * @return 洗衣订单
     */
    public OrderCloth selectOrderClothById(Long id);

    /**
     * 查询洗衣订单列表
     *
     * @param orderCloth 洗衣订单
     * @return 洗衣订单集合
     */
    public List<OrderCloth> selectOrderClothList(OrderCloth orderCloth);

    /**
     * 新增洗衣订单
     *
     * @param orderCloth 洗衣订单
     * @return 结果
     */
    public int insertOrderCloth(OrderCloth orderCloth);

    /**
     * 修改洗衣订单
     *
     * @param orderCloth 洗衣订单
     * @return 结果
     */
    public int updateOrderCloth(OrderCloth orderCloth);

    /**
     * 批量删除洗衣订单
     *
     * @param ids 需要删除的洗衣订单主键集合
     * @return 结果
     */
    public int deleteOrderClothByIds(Long[] ids);

    /**
     * 删除洗衣订单信息
     *
     * @param id 洗衣订单主键
     * @return 结果
     */
    public int deleteOrderClothById(Long id);


    /**
     * 查询待上挂，订单衣服明细列表
     */
    public List<ClothHangerOrderRelationVO> getNoHangerOrderClothList();

    /**
     * 查询上挂洗衣订单衣服明细
     */
    public ClothHangerOrderRelationVO getOrderClothInfoByWashCode(String washCode);

    /**
     * 查询配送员接单记录列表
     */
    public List<OrderClothRecordVO> getDeliveryOrderRecordList(AppDeliveryManListQueryDTO appDeliveryManListQueryDTO);

    /**
     * 获取预约洗衣订单
     */
    public List<OrderClothAppointmentVO> getAppointmentClothOrderList(OrderAppointmentDTO2 orderAppointmentDTO2);

    /**
     * 检测订单状态 (对所有订单进行判断)
     */
    void checkAllOrderStatus(Long orderClothId, String orderStatus);
}
