package cn.reghao.tnb.content.app.data.controller;

import cn.reghao.jutil.jdk.web.db.PageList;
import cn.reghao.tnb.common.web.WebResult;
import cn.reghao.tnb.content.app.data.model.dto.VoteDto;
import cn.reghao.tnb.content.app.data.model.dto.VoteProgressDto;
import cn.reghao.tnb.content.app.data.model.po.Vote;
import cn.reghao.tnb.content.app.data.service.VoteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author reghao
 * @date 2025-08-05 17:04:55
 */
@Tag(name = "投票接口")
@RestController
@RequestMapping("/api/content/vote")
public class VoteController {
    private final VoteService voteService;

    public VoteController(VoteService voteService) {
        this.voteService = voteService;
    }

    @Operation(summary = "添加新投票", description = "N")
    @PostMapping("/add")
    public String addVote(@RequestBody @Validated VoteDto voteDto) {
        return WebResult.success();
    }

    @Operation(summary = "获取投票列表", description = "N")
    @GetMapping("/list")
    public String getVoteList(@RequestParam("pn") Integer pn) {
        PageList<Vote> pageList = PageList.empty();
        return WebResult.success(pageList);
    }

    @Operation(summary = "获取某项投票", description = "N")
    @GetMapping("/get/{voteId}")
    public String getVote(@PathVariable("voteId") Long voteId) {
        return WebResult.success();
    }

    @Operation(summary = "进行投票", description = "N")
    @PostMapping("/progress")
    public String publishVote(@RequestBody @Validated VoteProgressDto voteProgressDto) {
        return WebResult.success();
    }

    @Operation(summary = "获取某项投票结果", description = "N")
    @GetMapping("/result/{voteId}")
    public String getVoteResult(@PathVariable("voteId") Long voteId) {
        return WebResult.success();
    }
}
