package jnpf.attendance.service;

import com.github.pagehelper.PageInfo;
import jnpf.base.service.SuperService;
import jnpf.entity.attendance.AttendanceOvertimeRule;
import jnpf.exception.HandleException;
import jnpf.model.attendance.dto.OvertimeRuleDto;
import jnpf.model.attendance.dto.OvertimeRuleQueryDto;
import jnpf.model.attendance.vo.attendance.OvertimeRuleDetailVo;
import jnpf.model.attendance.vo.attendance.OvertimeRulePageVo;
import jnpf.model.attendance.vo.attendance.OvertimeRuleVo;

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

/**
 * 加班规则服务
 *
 * @author yanwenfu
 * @create 2025-09-18
 */
public interface OvertimeRuleService extends SuperService<AttendanceOvertimeRule> {

    /**
     * 新增加班规则
     * @param overtimeRuleDto 加班规则dto
     */
    void addOvertimeRule(OvertimeRuleDto overtimeRuleDto) throws HandleException;

    /**
     * 编辑加班规则
     * @param id 加班规则id
     * @param overtimeRuleDto 加班规则dto
     */
    void updateOvertimeRule(String id, OvertimeRuleDto overtimeRuleDto) throws HandleException;

    /**
     * 删除加班规则
     * @param id 加班规则id
     */
    void deleteOvertimeRule(String id);

    /**
     * 禁用/启用加班规则
     * @param id 加班规则id
     */
    void updateEnableStatus(String id) throws HandleException;

    /**
     * 查询加班规则详情
     * @param id 加班规则id
     * @return jnpf.model.attendance.vo.attendance.OvertimeRuleVo
     */
    OvertimeRuleVo getDetail(String id);

    /**
     * 查询启用中的规则详情
     * @param ruleId 加班规则id
     * @return jnpf.model.attendance.vo.attendance.OvertimeRuleVo
     */
    OvertimeRuleVo getActiveDetail(String ruleId);

    /**
     * 查询生效中的规则详情
     * 若attendanceType为null 则 effectRuleDetail为null
     * 若节假日/公休日/工作日配置未启用, 则获取到的effectRuleDetail为null
     * @param userId 用户id
     * @param attendanceType 考勤类型
     * @param date 日期
     * @return jnpf.model.attendance.vo.attendance.OvertimeRuleVo
     */
    OvertimeRuleVo getEffectDetail(String userId, Integer attendanceType, Date date);

    /**
     * 查询考勤组加班规则
     * @param groupId 考勤组id
     * @return jnpf.model.attendance.vo.attendance.OvertimeRuleVo
     */
    OvertimeRuleVo getGroupOvertimeRule(String groupId);

    /**
     * 查询[多用户]生效中的规则详情
     * 若attendanceType为null 则 effectRuleDetail为null
     * 若节假日/公休日/工作日配置未启用, 则获取到的effectRuleDetail为null
     * @param userIds 用户ids
     * @param date 日期
     * @return java.util.Map<java.lang.String,jnpf.model.attendance.vo.attendance.OvertimeRuleVo>
     */
    Map<String, OvertimeRuleVo> getEffectDetailByUserList(List<String> userIds, Date date);

    /**
     * 根据出勤类型获取节假日/公休日/工作日配置
     * @param rule 规则
     * @param date 日期
     * @param attendanceType 出勤类型
     * @return jnpf.model.attendance.vo.attendance.OvertimeRuleDetailVo
     */
    OvertimeRuleDetailVo getEffectWorkDetail(OvertimeRuleVo rule, Date date, Integer attendanceType);

    /**
     * 查询加班规则列表(分页)
     * @param queryDto 查询条件
     * @return com.github.pagehelper.PageInfo<jnpf.model.attendance.vo.attendance.OvertimeRulePageVo>
     */
    PageInfo<OvertimeRulePageVo> getPage(OvertimeRuleQueryDto queryDto);
}
