package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxOrderCouponPressVo;
import com.iformall.domain.vo.WxOrderCouponVo;
import com.iformall.domain.vo.WxOrderQueryVo;
import com.iformall.enums.EnumOrderStatus;

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

public interface WxOrderService {

	/**
     * 根据实体查询分页列表
     *
     * @param record
     * @param pageIndex
     * @param pageSize
     * @return
     */
	PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize);


    /**
     * 根据日期 b用户查刷卡支付list
     *
     * @param bUserId B端用户)
     */

    ResultData microPayListOnDateAsPage(Long bUserId, Integer type, String date, Integer pageIndex, Integer pageSize);


    /**
     * 提交订单
     * @param user
     * @param couponId
     * @param orderGroupId
     * @return 订单id
     */
    WxOrder saveCouponOrder(WxCUser user, Long couponChannelId, Long couponId, boolean isPress, Long orderGroupId);

    /**
     * 付款码支付
     * @param user
     * @param totalFeeStr
     * @return 订单id
     */
    WxOrder saveMicroPayOrder(WxMerchantBUser user, String totalFeeStr);

    /**
     * 商户码-储值卡支付
     * @param merchant
     * @param cUser
     * @param totalFeeStr
     * @param payment
     * @return 订单id
     */
    WxOrder saveCardPayOrder(WxMerchant merchant, WxCUser cUser, String totalFeeStr, Integer payment);

    /**
     * 免费券订单接口
     * @param userId
     * @param couponId
     * @return WxOrder
     */
    WxOrder saveFreeCouponOrder(Long userId, Long couponChannelId, Long couponId);

    /**
     * 免费券订单接口
     * @param userId
     * @param couponId
     * @return WxCouponOrder
     */
    WxCouponOrder sendFreeCouponToUser(Long userId, Long couponId);

    /**
     * orderSuccess 订单已支付
     * @param updateOrder
     * @return
     */
    int couponOrderSuccess(WxOrder updateOrder);

    /**
     * microPayOrderSuccess 刷卡支付成功
     * @param updateOrder
     * @return
     */
    int microPayOrderSuccess(WxOrder updateOrder);

    /**
     * updateOrderStatus 更新订单状态, 只针对已取消及已退款
     * @param updateOrder
     * @param enumOrderStatus
     */
    int updateOrderStatus(WxOrder updateOrder, EnumOrderStatus enumOrderStatus);

    /**
     * 订单关单
     */
    ResultData orderClose(WxOrder order);

    /**
     * 根据Id获得实体
     *
     * @param id
     * @return
     */
    WxOrder getById(Long id);
    
        /**
     * 保存或更新实体
     *
     * @param record
     */
    void saveOrUpdate(WxOrder record);

    /**
     * 根据Id删除实体
     *
     * @param id
     */
    void deleteById(Long id);
    /**
     * 条件查询不分页
     * @param record
     * @return
     */
    List<WxOrder> findList(WxOrder record);



    PageInfo<WxOrderCouponVo> listCUserVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize);


    WxOrderCouponVo detailCUserVo(WxOrder record);

    void stockBack(WxOrder updateOrder);

    /**
     * microPay分账
     * @param orderId
     * @param payOrderId
     */
    void shareForMicroPay(String tenantId, Long orderId, Long payOrderId);

    PageInfo<WxOrder> listOrderAsPage(WxOrderQueryVo wxOrder, Integer pageNum, Integer pageSize);

    Map<String,Object> queryOrderSummary(String tenantId);

    /**
     * 砍价订单
     */
    PageInfo<WxOrderCouponPressVo> listPressVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize);

    WxOrderCouponPressVo detailPressVo(WxOrder record);

    void updateStatusByPressCouponId(Long couponId,String tenantId,int orderStatus);

    void updateOrderStatus(WxOrder order);

}
