package jnpf.attendance.controller;

import jnpf.attendance.service.AttendanceAIService;
import jnpf.base.ActionResult;
import jnpf.model.attendance.dto.AttendanceReqDto;
import jnpf.model.attendance.vo.attendance.ClockDataReqVo;
import jnpf.model.attendance.vo.attendance.OvertimeRuleVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 考勤AI接口支持
 *
 * @author yanwenfu
 * @create 2026-05-07
 */
@RestController
@RequestMapping(value = "/attendance/ai")
public class AttendanceAIController {

    @Resource
    private AttendanceAIService attendanceAIService;

    /**
     * 根据日期查询考勤打卡记录
     * @param dto 查询条件
     * @return jnpf.base.ActionResult<jnpf.model.attendance.vo.attendance.ClockDataReqVo>
     */
    @GetMapping(value = "/clock-record")
    public ActionResult<ClockDataReqVo> getClockRecordByDate(AttendanceReqDto dto) {

        ClockDataReqVo req = attendanceAIService.getClockRecordByDate(dto);
        return ActionResult.success(req);
    }

    /**
     * 查询考勤组加班规则
     * @param groupId 考勤组id
     * @return jnpf.base.ActionResult<jnpf.model.attendance.vo.attendance.OvertimeRuleVo>
     */
    @GetMapping(value = "/overtime-rule/{groupId}")
    public ActionResult<OvertimeRuleVo> getOvertimeRule(@PathVariable(value = "groupId") String groupId) {

        OvertimeRuleVo vo = attendanceAIService.getOvertimeRule(groupId);
        return ActionResult.success(vo);
    }
}
