package cn.iocoder.yudao.module.system.controller;

import cn.hutool.json.JSONObject;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.service.attendance.AttendanceService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

@Tag(name = "管理后台 - 考勤机打卡")
@RestController
@RequestMapping("/api/v1")
@Validated
@Slf4j
public class AttendanceEquipmentController {
    @Resource
    private AttendanceService attendanceService;

    @PostMapping("/verify_user")
    @PermitAll
    public JSONObject verifyUser(@RequestBody JSONObject object) {
        TenantContextHolder.setTenantId(1L);
        return attendanceService.attendanceMachineCheck(object);
    }
}
