package com.changhu.module.miniProgram.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 20252
 * @createTime 2024/9/6 上午10:42
 * @desc MiniProgramUserController...
 */
@Tag(name = "小程序用户接口")
@JsonBody
@RequestMapping("/miniProgramUser")
public class MiniProgramUserController {

    @Autowired
    private MiniProgramUserService miniProgramUserService;

    @Operation(summary = "注册")
    @PostMapping("/register")
    public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
        miniProgramUserService.register(params);
    }

    @Operation(summary = "二维码表单录入保安人员")
    @PostMapping("/qrCodeFormInputSecurityUser")
    public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
        miniProgramUserService.qrCodeFormInputSecurityUser(params);
    }

    @Operation(summary = "服务项目保安人员分页")
    @PostMapping("/securityUserPager")
    public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
        return miniProgramUserService.securityUserPager(queryParams);
    }
}
