package com.yida.data.device.studentCard.controller.out;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.device.studentCard.service.EduStudentCardService;
import com.yida.data.device.vo.OnlineCountVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "学生证-学生证")
@Slf4j
@Validated
@RestController
@RequestMapping("/out/studentCard/card")
@RequiredArgsConstructor
public class OutEduStudentCardController {

    private final EduStudentCardService eduStudentCardService;

    @ApiOperation("查询电子学生证在线离线数量")
    @GetMapping("/getOnlineDistrib")
    public ResultBean<OnlineCountVO> getOnlineDistrib(Long[] schoolIds) {
        return ResultBean.buildSuccess(eduStudentCardService.getCardDistrib(Arrays.asList(schoolIds)));
    }
}
