package com.yida.data.attendance.controller.h5;

import com.yida.data.attendance.service.EduAttendanceRuleTimeService;
import com.yida.data.attendance.vo.RuleTimeVO;
import com.yida.data.common.core.common.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.time.LocalDate;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "考勤-前台-考勤记录")
@RequiredArgsConstructor
@RestController
@RequestMapping("/h5/ruleTime")
public class H5EduAttendanceRuleController {

    private final EduAttendanceRuleTimeService eduAttendanceRuleTimeService;

    @ApiOperation("查询班级某天匹配的规则时间")
    @GetMapping("/listDeptRuleTime")
    public ResultBean<List<RuleTimeVO>> listDeptRuleTime(Long deptId, @ApiParam("日期,yyyy-MM-dd") String date,
        @ApiParam("规则类型，0-校门，1-宿舍") Integer type) {
        return ResultBean.buildSuccess(eduAttendanceRuleTimeService.listDeptRuleTime(deptId, LocalDate.parse(date), type));
    }
}
