package com.nanyan.securitylink.controller;

import com.alibaba.fastjson.JSONObject;
import com.nanyan.securitylink.dto.AIRequestDTO;
import com.nanyan.securitylink.service.AIService;
import com.nanyan.securitylink.vo.AIResponse;
import com.nanyan.securitylink.vo.CodeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.nanyan.securitylink.vo.Response;

@RestController
public class AIController {
    @Autowired
    AIService aiService;
    @PostMapping("/translate")
    public Response<AIResponse<String>> translate(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.translate(AIRequestDTO));
    }
    @PostMapping("/news/tag")
    public Response<AIResponse<CodeVO>> newsTag(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.newsTags(AIRequestDTO));
    }
    @PostMapping("/natural/disaster/tag")
    public Response<AIResponse<CodeVO>> naturalDisasterTag(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.naturalDisasterTag(AIRequestDTO));
    }

    @PostMapping("/news/tag/translate")
    public Response<AIResponse<JSONObject>> newsTagAndTranslate(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.newsTagAndTranslate(AIRequestDTO));
    }

    @PostMapping("/urgent/notice")
    public Response<AIResponse<JSONObject>> dealUrgentNotice(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.dealUrgentNotice(AIRequestDTO));
    }

    @PostMapping("/news/country/city")
    public Response<AIResponse<JSONObject>> collectNewsCountryAndCity(@RequestBody AIRequestDTO AIRequestDTO) {
        return Response.SUCCESS(aiService.collectNewsCountryAndCity(AIRequestDTO));
    }
}