package com.lion.lionwebsite.Controller;

import com.lion.lionwebsite.Service.TagService;
import com.lion.lionwebsite.Util.Response;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/GalleryManage")
public class TagController {

    TagService tagService;

    public TagController(TagService tagService) {
        this.tagService = tagService;
    }

    @PostMapping("/tag")
    public String createTag(String tag){
        return tagService.createTag(tag);
    }

    @PostMapping("/tagAndMark")
    public String createTagAndMark(Integer gid, String tag){
        return tagService.createTagAndMark(gid, tag);
    }

    @DeleteMapping("/tag")
    public String deleteTag(Integer tid){
        return tid == null ? Response._failure("参数错误") : tagService.deleteTag(tid);
    }

    @PostMapping("/mark")
    public String markTag(Integer gid, Integer tid){
        return tagService.markTag(gid, tid);
    }

    @PostMapping("/disMark")
    public String disMarkTag(Integer gid, Integer tid){
        return tagService.disMarkTag(gid, tid);
    }

    @GetMapping("/allTag")
    public String allTag(){
        return tagService.selectAllTag();
    }
}
