package com.wmyun.module.infra.controller.admin.word;

import com.wmyun.farmwork.word.core.model.BookmarkQueryDataModel;
import com.wmyun.farmwork.word.core.model.BookmarkReplaceDataModel;
import com.wmyun.farmwork.word.deprecated.core.model.gen.TagsGenDataModel;
import com.wmyun.framework.common.pojo.CommonResult;
import com.wmyun.module.infra.service.file.WordBookmarkService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * @Description: TODO
 * @Date: 2025/3/3 9:36
 * @Created: by ZZSLL
 */

@Tag(name = "管理后台 - Word bookmark替换")
@RestController
@RequestMapping("/infra/word/bookmark")
public class WordBookmarkController {

    @Autowired
    private WordBookmarkService service;

    @PostMapping("/file/{fileId}")
    public CommonResult<Set<String>> requestAllBookmarks(@PathVariable("fileId") String fileId) {
        return CommonResult.success(service.queryAllBookmarks(fileId));
    }

    @PostMapping("/file/{fileId}/generate")
    public CommonResult<Object> doGenerate(@PathVariable("fileId") String fileId, @RequestBody List<BookmarkReplaceDataModel> data) {
        return CommonResult.success(service.replaceBookmarkWithContent(fileId, data));
    }
}
