package com.sonic.frog.controller.web;

import com.sonic.common.auth.domains.Session;
import com.sonic.common.rpc.Result;
import com.sonic.frog.domain.output.AiChatRankOutput;
import com.sonic.frog.domain.output.AiGiftRankOutput;
import com.sonic.frog.domain.output.AiHeartbeatRankOutput;
import com.sonic.frog.service.RankService;
import com.sonic.sdk.api.annotation.IgnoreAuth;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
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.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Web-榜单
 *
 * @author code
 */
@Slf4j
@Validated
@RestController
public class RankWeb {

    @Autowired
    private RankService rankService;

    @IgnoreAuth
    @ApiOperation(value = "热聊榜", tags = {"Web-榜单"})
    @PostMapping("/web/rank/chat")
    public Result<List<AiChatRankOutput>> chatRank(@ApiParam(hidden = true) Session session, @ApiParam(hidden = true) HttpServletRequest request) {
        return Result.success(rankService.chatRank(session.getUserId(), 100));
    }


    @IgnoreAuth
    @ApiOperation(value = "AI的总心动值榜单", tags = {"Web-榜单"})
    @PostMapping("/web/rank/heartbeat")
    public Result<List<AiHeartbeatRankOutput>> aiHeartbeatRank(@ApiParam(hidden = true) Session session, @ApiParam(hidden = true) HttpServletRequest request) {
        return Result.success(rankService.aiHeartbeatRank(session.getUserId(), 100));
    }


    @IgnoreAuth
    @ApiOperation(value = "礼物榜单", tags = {"Web-榜单"})
    @PostMapping("/web/rank/gift")
    public Result<List<AiGiftRankOutput>> giftRank(@ApiParam(hidden = true) Session session, @ApiParam(hidden = true) HttpServletRequest request) {
        return Result.success(rankService.giftRank(session.getUserId(), 100));
    }

}
