package jnpf.attendance.service.impl;

import jnpf.attendance.mapper.RuleScopeMapper;
import jnpf.attendance.service.RuleScopeService;
import jnpf.base.service.SuperServiceImpl;
import jnpf.entity.attendance.AttendanceRuleScope;
import jnpf.enums.attendance.ScopeBizType;
import jnpf.model.attendance.dto.UserOrgDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 适配范围服务实现
 *
 * @author yanwenfu
 * @create 2025-09-18
 */
@Service
public class RuleScopeServiceImpl extends SuperServiceImpl<RuleScopeMapper, AttendanceRuleScope> implements RuleScopeService {

    @Resource
    private RuleScopeMapper ruleScopeMapper;

    @Override
    public List<AttendanceRuleScope> selectUserEffectList(String userId, String organizeId, ScopeBizType bizType) {

        return ruleScopeMapper.selectUserEffectList(userId, organizeId, bizType.getValue());
    }

    @Override
    public List<AttendanceRuleScope> selectUserEffectListBatch(List<UserOrgDto> userOrgList, ScopeBizType bizType, Integer priority,List<String> leaveTypeIds) {

        return ruleScopeMapper.selectUserEffectListBatch(userOrgList, bizType.getValue(), priority, leaveTypeIds);
    }

    @Override
    public List<AttendanceRuleScope> selectOrgEffectListBatch(String organizeId) {
        return ruleScopeMapper.selectOrgEffectListBatch(organizeId, ScopeBizType.LEAVE_RULES.getValue());
    }
}
