package com.ssyf.module.robot.controller.auth;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import com.ssyf.common.web.apicode.ApiCodeUser;
import com.ssyf.common.web.result.Result;
import com.ssyf.module.robot.domain.entity.ChatInfo;
import com.ssyf.module.robot.domain.query.ChatInfoQuery;
import com.ssyf.module.robot.domain.vo.ChatInfoVo;
import com.ssyf.module.robot.service.ChatInfoService;
import com.ssyf.plugs.logger.Log;
import com.ssyf.plugs.mysql.helper.PageEnhanceHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 聊天配置开放接口
 *
 * @author: auth
 * @date: 2026-01-31
 */
@Api(tags="基础-聊天配置")
@RestController
@RequestMapping("/auth/ChatInfo")
public class ChatInfoAuthController {

    @Autowired
    private ChatInfoService baseService;


    /**
     * 分页查询聊天配置
     */
    @ApiOperation("分页查询聊天配置")
    @PostMapping("/queryPage")
    public Result<IPage<ChatInfoVo>> queryPage(@Validated @RequestBody ChatInfoQuery query) {
        PageInfo<ChatInfo> temp = this.baseService.getPage(query);
        return Result.success(PageEnhanceHelper.switchPageInfo(temp, ChatInfoVo.class));
    }

    /**
     * 查询聊天配置列表
     */
    @ApiOperation("查询聊天配置列表")
    @PostMapping("/queryList")
    public Result<List<ChatInfoVo>> queryList(@Validated @RequestBody ChatInfoQuery query) {
        PageInfo<ChatInfo> temp = this.baseService.getPage(query);
        return Result.success(PageEnhanceHelper.switchPageInfo(temp, ChatInfoVo.class));
    }
}