package com.greenorange.promotion.service.project;

import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionUniteUpdateRequest;
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionUpdateRequest;
import com.greenorange.promotion.model.entity.ProjectCommission;
import com.baomidou.mybatisplus.extension.service.IService;
import com.greenorange.promotion.model.entity.SubUserProjectCommission;
import jakarta.servlet.http.HttpServletRequest;

import java.math.BigDecimal;
import java.util.List;

/**
* @author 35880
* @description 针对表【project_commission(项目明细抽佣表)】的数据库操作Service
* @createDate 2025-05-09 18:42:17
*/
public interface ProjectCommissionService extends IService<ProjectCommission> {


    /**
     * 修改项目的抽佣比例
     */
    void updateProjectCommissionRate(ProjectCommissionUpdateRequest projectCommissionUpdateRequest);


    /**
     * 修改下级用户的项目明细抽佣比例
     */
    void updateSubUserProjectCommissionRate(SubUserProjectCommissionUpdateRequest subUserProjectCommissionUpdateRequest);


    /**
     * 小程序用户一键设置项目的的抽佣比例
     */
    void uniteProjectCommissionRate(ProjectCommissionUniteUpdateRequest projectCommissionUniteUpdateRequest, HttpServletRequest request);


    /**
     * 批量修改下级用户的单价
     */
    void batchUpdateSubUserMyUnitPrice(List<SubUserProjectCommission> subCommissionList);


    /**
     * 批量修改用户的单价
     */
    void batchUpdateMyUnitPrice(List<ProjectCommission> projectCommissionList);


    /**
     * 对项目抽佣记录进行排序(根据userId, subUserId进行排序）
     */
    void sortSubProjectCommissions(List<SubUserProjectCommission> subProjectCommissions);


    /**
     * 对项目抽佣记录进行排序(根据projectDetailId, userId, subUserId进行排序）
     */
    void sortProjectDetailAndSubProjectCommissions(List<SubUserProjectCommission> subProjectCommissions);


    /**
     * 根据价格和抽佣比例计算最终价格
     */
    BigDecimal calculateFinalPrice(BigDecimal price, BigDecimal commissionRate);

}
