package org.jeecg.modules.ctop.controller;

import com.alibaba.fastjson.JSONArray;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.ctop.service.ICreativeTitleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ctop/creativeTitle/")
public class CreativeTitleController {

    @Autowired
    private ICreativeTitleService creativeTitleService;

    @GetMapping("getTitleLabel")
    public Result<JSONArray> getTitleLabel() {
        Result<JSONArray> result = new Result<>();
        JSONArray labelArr = creativeTitleService.getTitleLabel();
        result.setSuccess(true);
        result.setResult(labelArr);
        return result;
    }

    @GetMapping("titleSuggestion")
    public Result<JSONArray> titleSuggestion(String firstCategory, String secondCategory, String keyword) {
        Result<JSONArray> result = new Result<>();
        JSONArray labelArr = creativeTitleService.titleSuggestion(firstCategory, secondCategory, keyword);
        result.setSuccess(true);
        result.setResult(labelArr);
        return result;
    }

    @GetMapping("titleSearch")
    public Result<JSONArray> titleSearch(String firstCategory, String secondCategory, String keywords) {
        Result<JSONArray> result = new Result<>();
        JSONArray labelArr = creativeTitleService.titleSearch(firstCategory, secondCategory, keywords);
        result.setSuccess(true);
        result.setResult(labelArr);
        return result;
    }
}
