package jnpf.attendance.service.impl;

import jnpf.attendance.mapper.AttendanceAIMapper;
import jnpf.attendance.service.AttendanceAIService;
import jnpf.attendance.service.OvertimeRuleService;
import jnpf.model.attendance.dto.AttendanceReqDto;
import jnpf.model.attendance.vo.attendance.ClockDataReqVo;
import jnpf.model.attendance.vo.attendance.ClockRecordVo;
import jnpf.model.attendance.vo.attendance.OvertimeRuleVo;
import org.springframework.stereotype.Service;

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

/**
 * 考勤ai服务实现
 *
 * @author yanwenfu
 * @create 2026-05-07
 */
@Service
public class AttendanceAIServiceImpl implements AttendanceAIService {

    @Resource
    private AttendanceAIMapper attendanceAIMapper;
    @Resource
    private OvertimeRuleService overtimeRuleService;

    @Override
    public ClockDataReqVo getClockRecordByDate(AttendanceReqDto dto) {

        LocalDate date = LocalDate.parse(dto.getQueryDate());
        ClockDataReqVo req = new ClockDataReqVo();
        req.setDate(date);
        // 查询考勤打卡记录
        List<ClockRecordVo> dataList = attendanceAIMapper.getClockRecordList(dto.getUserId(), dto.getQueryDate());
        req.setDataList(dataList);
        return req;
    }

    @Override
    public OvertimeRuleVo getOvertimeRule(String groupId) {

        return overtimeRuleService.getGroupOvertimeRule(groupId);
    }
}
