package com.qqchen.deploy.backend.workflow.api;

import com.qqchen.deploy.backend.framework.api.Response;
import com.qqchen.deploy.backend.framework.controller.BaseController;
import com.qqchen.deploy.backend.workflow.dto.FormCategoryDTO;
import com.qqchen.deploy.backend.workflow.dto.query.FormCategoryQuery;
import com.qqchen.deploy.backend.workflow.entity.FormCategory;
import com.qqchen.deploy.backend.workflow.service.IFormCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 表单分类API控制器
 *
 * @author qqchen
 * @date 2025-10-24
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/forms/categories")
@Tag(name = "表单分类管理", description = "表单分类管理相关接口")
public class FormCategoryApiController extends BaseController<FormCategory, FormCategoryDTO, Long, FormCategoryQuery> {

    @Resource
    private IFormCategoryService formCategoryService;

    @Operation(summary = "查询所有启用的分类")
    @GetMapping("/enabled")
    public Response<List<FormCategoryDTO>> findAllEnabled() {
        List<FormCategoryDTO> result = formCategoryService.findAllEnabled();
        return Response.success(result);
    }

    @Override
    protected void exportData(jakarta.servlet.http.HttpServletResponse response, java.util.List<FormCategoryDTO> data) {
        // 暂不支持导出
    }
}

