package com.yonge.cooleshow.biz.dal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yonge.cooleshow.biz.dal.dto.search.VipRecordSearch;
import com.yonge.cooleshow.biz.dal.entity.ActivityReward;
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.enums.EVipType;
import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
import com.yonge.cooleshow.biz.dal.vo.VipRecordVo;
import com.yonge.cooleshow.biz.dal.vo.VipCardRecordVo;
import com.yonge.cooleshow.biz.dal.dto.search.VipCardRecordSearch;
import com.yonge.cooleshow.biz.dal.entity.VipCardRecord;
import com.yonge.cooleshow.biz.dal.wrapper.VipCardRecordWrapper;
import com.yonge.toolset.base.page.PageInfo;

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

/**
 * 购买会员卡记录表 服务类
 *
 * @author liweifan
 * @date 2022-03-30
 */
public interface VipCardRecordService extends IService<VipCardRecord> {
    /**
     * 查询详情
     *
     * @author liweifan
     * @date 2022-03-30
     */
    VipCardRecordVo detail(Long orderDetilId);

    /**
     * 查询详情
     *
     * @author liweifan
     * @date 2022-03-30
     */
    VipCardRecordVo detail(Long orderDetilId, Long userId);

    /**
     * 构建VipCardRecord对象
     * @param orderDetailVo
     * @return
     */
    VipCardRecord buildVipCardRecordByOrderDetail(UserOrderDetailVo orderDetailVo);

    /**
     * 活动构建vip card record 对象
     *
     * @param userId 用户id
     * @param client 客户端类型
     * @param activityReward 活动奖品
     * @param activityId 活动id
     * @return
     */
    VipCardRecord buildVipCardRecordByOrderDetail(Long userId, ClientEnum client, ActivityReward activityReward, Long activityId,String activityName);

    VipCardRecord getVipCardRecord(Long userId, ClientEnum client, String orderNo, String subOrderNo, String periodType, Long memberPriceSettingsId, Integer timeNum, SourceTypeEnum sourceType, Long createBy, String reason);

    /**
     * 分页查询
     *
     * @author liweifan
     * @date 2022-03-30
     */
    IPage<VipCardRecordVo> selectPage(IPage<VipCardRecordVo> page, VipCardRecordSearch query);

    /***
     * 会员卡到期提醒
     * @author liweifan
     * @updateTime 2022/5/5 19:28
     */
    void pollExpireMsg();

    /**
     * 会员添加记录
     *
     * @param recordSearch
     * @return
     */
    PageInfo<VipRecordVo> vipRecord(VipRecordSearch recordSearch);

    /**
     * 获取生效中的会员记录
     *
     * @param userId
     * @param clientEnum
     * @return
     */
    List<VipCardRecord> getEfficientVipRecord(List<Long> userId, ClientEnum clientEnum);

    VipCardRecordWrapper.UserVip UserVipInfo(Long userId, ClientEnum clientEnum);

    /**
     * 用户会员信息
     *
     * @param userId
     * @param clientEnum
     * @return
     */
    VipCardRecordWrapper.UserVip userVipInfo(Long userId, ClientEnum clientEnum);

    void add(VipCardRecordWrapper.AddVipCardRecord addVipCardRecord);

    /**
     * 获取用户会员类型
     *
     * @param studentIds
     * @param client
     * @return
     */
    Map<Long, EVipType> getVipTypeMapByUserIds(List<Long> studentIds, ClientEnum client);

    // 会员添加
    VipCardRecord addVip(VipCardRecordWrapper.AddVipCardRecord addVipCardRecord);

    List<VipCardRecordWrapper.UserVipInfo> queryUserVipInfo(List<Long> userIdList , String clientType);
}