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

import com.ssyf.common.web.result.Result;
import com.ssyf.module.robot.domain.query.ChatActivityStatisticsQuery;
import com.ssyf.module.robot.domain.query.ConsumptionStatisticsQuery;
import com.ssyf.module.robot.domain.query.LiveRoomStatisticsQuery;
import com.ssyf.module.robot.domain.vo.ChatActivityStatisticsVo;
import com.ssyf.module.robot.domain.vo.ConsumptionStatisticsVo;
import com.ssyf.module.robot.domain.vo.LiveRoomStatisticsVo;
import com.ssyf.module.robot.domain.vo.RobotStatisticsVo;
import com.ssyf.module.robot.service.RobotStatisticsService;
import com.ssyf.plugs.logger.Log;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页统计开放接口
 * 
 * @author ELSA
 * @date: 2026-02-26
 */
@Api(tags="基础-首页统计")
@RestController
@RequestMapping("/auth/HomePage")
public class HomePageAuthController {

    @Autowired
    private RobotStatisticsService robotStatisticsService;

    /**
     * 获取机器人统计信息
     */
    @Log(title = "首页统计-获取机器人统计信息")
    @ApiOperation("获取机器人统计信息")
    @PostMapping("/getRobotStatistics")
    public Result<RobotStatisticsVo> getRobotStatistics(@RequestBody(required = false) Object requestBody) {
        RobotStatisticsVo statistics = robotStatisticsService.getRobotStatistics();
        return Result.success(statistics);
    }

    /**
     * 获取消费统计信息
     */
    @Log(title = "首页统计-获取消费统计信息")
    @ApiOperation("获取消费统计信息")
    @PostMapping("/getConsumptionStatistics")
    public Result<ConsumptionStatisticsVo> getConsumptionStatistics(@Validated @RequestBody ConsumptionStatisticsQuery query) {
        ConsumptionStatisticsVo statistics = robotStatisticsService.getConsumptionStatistics(query);
        return Result.success(statistics);
    }

    /**
     * 获取直播间统计信息
     */
    @Log(title = "首页统计-获取直播间统计信息")
    @ApiOperation("获取直播间统计信息")
    @PostMapping("/getLiveRoomStatistics")
    public Result<LiveRoomStatisticsVo> getLiveRoomStatistics(@Validated @RequestBody LiveRoomStatisticsQuery query) {
        LiveRoomStatisticsVo statistics = robotStatisticsService.getLiveRoomStatistics(query);
        return Result.success(statistics);
    }

    /**
     * 获取发言活跃度统计信息
     */
    @Log(title = "首页统计-获取发言活跃度统计信息")
    @ApiOperation("获取发言活跃度统计信息")
    @PostMapping("/getChatActivityStatistics")
    public Result<ChatActivityStatisticsVo> getChatActivityStatistics(@Validated @RequestBody ChatActivityStatisticsQuery query) {
        ChatActivityStatisticsVo statistics = robotStatisticsService.getChatActivityStatistics(query);
        return Result.success(statistics);
    }
}