package com.competition.modules.pub.controller;

import com.competition.common.result.Result;
import com.competition.modules.pub.service.PublicTagService;
import com.competition.modules.ugc.entity.UgcTag;
import com.competition.security.annotation.Public;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "标签")
@RestController
@RequestMapping("/public/tags")
@RequiredArgsConstructor
public class PublicTagController {

    private final PublicTagService publicTagService;

    @Public
    @GetMapping
    @Operation(summary = "获取所有标签")
    public Result<List<UgcTag>> listTags() {
        return Result.success(publicTagService.listTags());
    }

    @Public
    @GetMapping("/hot")
    @Operation(summary = "获取热门标签")
    public Result<List<UgcTag>> getHotTags() {
        return Result.success(publicTagService.getHotTags());
    }
}
