package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
import com.ym.mec.biz.dal.entity.*;
import com.ym.mec.biz.dal.page.CloudTeacherAddQueryInfo;
import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.service.BaseService;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;


public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacherOrder> {

    /**
     * 查询未激活用户
     */
    PageInfo<CloudTeacherStudent> queryInactive(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception;


    /**
     * 将订单详情云教练加入云教练购买列表
     *
     * @param order
     * @return
     */
    void addOrderDetail2CloudTeacher(StudentPaymentOrder order, BigDecimal cloudTeacherFee);

    /**
    * @description: 激活团练宝
     * @param now
     * @param cloudTeacherOrder
    * @return void
    * @author zx
    * @date 2022/3/21 11:10
    */
    void activationMember(Date now, CloudTeacherOrder cloudTeacherOrder);

    Date calcCloudTeacherOrderTime(CloudTeacherOrder cloudTeacherOrder, Date startTime, Date endTime);

    /**
     * 获取乐团云教练订单
     *
     * @param studentIds
     * @param musicGroupId
     * @return
     */
    List<CloudTeacherOrder> getStudentCloudTeacherOrders(List<Integer> studentIds, String musicGroupId);

    /**
     * 根据订单编号查询订单详情
     *
     * @param orderId
     * @return
     */
    CloudTeacherOrderDto queryOrderInfoByOrderId(Long orderId);

    List<Map<Long, String>> queryNoStartByUserIds(Set<Integer> userIds, Boolean isMusicMember);

    /**
     * 获取学员购买的云教练活动订单
     *
     * @param userId
     * @param activeRemark
     * @param remark
     * @return
     */
    String queryActiveOrderPage(Integer userId, Integer activeRemark, String remark);

    /**
     * 支付未激活用户
     *
     * @param cloudTeacherStudents 选择中用户清单
     * @return 是否成功
     */
    Map<String, Object> pay(List<CloudTeacherStudent> cloudTeacherStudents) throws Exception;

    Boolean payCheck(String orderNo);

    PageInfo<CloudTeacherStudent> queryRecord(CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo);

    int sendSms(TenantOrderRecord record);

    /**
    * @description: 批量新增学员云教练
     * @param cloudTeacherOrder
     * @param userIds
     * @param autoActivationFlag
    * @return void
    * @author zx
    * @date 2022/3/21 11:21
    */
    void batchInsert(CloudTeacherOrder cloudTeacherOrder, List<Integer> userIds,Boolean autoActivationFlag);

    /**
    * @description: 通过团练宝缴费项目获取初始化的云教练订单
     * @param cloudCoachPaymentProgram
    * @return com.ym.mec.biz.dal.entity.CloudTeacherOrder
    * @author zx
    * @date 2022/3/21 11:40
    */
    CloudTeacherOrder getInitCloudTeacherOrder(CloudCoachPaymentProgram cloudCoachPaymentProgram);

    /**
    * @description: 保存云教练订单
     * @param cloudTeacherOrder
     * @param autoActivationFlag
    * @return void
    * @author zx
    * @date 2022/3/21 11:59
    */
    void save(CloudTeacherOrder cloudTeacherOrder,Boolean autoActivationFlag);

    CloudTeacherOrder queryByOrderId(Long orderId);
}
