package org.xyzh.study.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xyzh.api.study.tag.CourseTagService;
import org.xyzh.common.core.domain.ResultDomain;
import org.xyzh.common.dto.study.TbCourseTag;
import org.xyzh.common.dto.study.TbCourse;

/**
 * @description 课程标签控制器
 * @filename CourseTagController.java
 * @author yslg
 * @copyright xyzh
 * @since 2025-10-15
 */
@RestController
@RequestMapping("/study/tag")
public class CourseTagController {
    private static final Logger logger = LoggerFactory.getLogger(CourseTagController.class);

    @Autowired
    private CourseTagService courseTagService;

    /**
     * 获取标签列表
     */
    @GetMapping("/list")
    public ResultDomain<TbCourseTag> getTagList(TbCourseTag filter) {
        return null;
        // return courseTagService.getTagList(filter);
    }

    /**
     * 根据ID获取标签详情
     */
    @GetMapping("/{tagID}")
    public ResultDomain<TbCourseTag> getTagById(@PathVariable String tagID) {
        return courseTagService.getTagById(tagID);
    }

    /**
     * 根据标签获取课程列表
     */
    @GetMapping("/{tagID}/courses")
    public ResultDomain<TbCourse> getCoursesByTag(@PathVariable String tagID) {
        return null;
        // return courseTagService.getCoursesByTag(tagID);
    }

    /**
     * 添加标签到课程
     */
    @PostMapping("/course/{courseID}/tag")
    public ResultDomain<TbCourseTag> addTagToCourse(
            @PathVariable String courseID,
            @RequestParam String tagID) {
        return null;
        // return courseTagService.addTagToCourse(courseID, tagID);
    }

    /**
     * 从课程移除标签
     */
    @DeleteMapping("/course/{courseID}/tag/{tagID}")
    public ResultDomain<Boolean> removeTagFromCourse(
            @PathVariable String courseID,
            @PathVariable String tagID) {
        return null;
        // return courseTagService.removeTagFromCourse(courseID, tagID);
    }

    /**
     * 获取课程标签列表
     */
    @GetMapping("/course/{courseID}/tags")
    public ResultDomain<TbCourseTag> getCourseTags(@PathVariable String courseID) {
        return courseTagService.getCourseTags(courseID);
    }
}
