/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.platform.service;

import org.springblade.common.enums.IntegralSourceEnum;
import org.springblade.modules.platform.entity.UserIntegral;
import org.springblade.modules.platform.vo.UserIntegralVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.system.entity.UserApp;

/**
 * 用户积分表 服务类
 *
 * @author BladeX
 * @since 2022-02-13
 */
public interface IUserIntegralService extends IService<UserIntegral> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param userScores
	 * @return
	 */
	IPage<UserIntegralVO> selectUserScoresPage(IPage<UserIntegralVO> page, UserIntegralVO userScores);

	/**
	 * 增加用户积分记录
	 * @param integral 增加的积分数
	 * @param userId 用户id
	 * @param userIntegral 用户原来的积分数
	 * @param integralSourceEnum 积分来源枚举
	 * @param remark 备注
	 * @return
	 * 		返回用户最终的积分数
	 */
	Double addIntegralRecord(Double integral, Long userId, Double userIntegral, IntegralSourceEnum integralSourceEnum, String remark);

	/**
	 * 获取邀请或者推荐的积分
	 * @return
	 */
	Double getInviteIntegral();

	/**
	 * 添加积分
	 * @param integral
	 * @param userId
	 * @param integralSourceEnum
	 * @param remark
	 */
	void addIntegral(Double integral, Long userId, IntegralSourceEnum integralSourceEnum, String remark);

	/**
	 * 扣减积分
	 */
	void reductionIntegral(Double integral, Long userId, String remark);

}
