package com.fufan.mtsaas.modules.emoon.controller;

import com.fufan.mtsaas.tools.TokenEncryptor;
import com.fufan.mtsaas.util.HttpUtils;
import org.apache.http.client.methods.HttpGet;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.UUID;

@RestController
@RequestMapping("/index")
public class InformationController {
    @PostMapping("/information")
    public ResponseEntity<String> information(@RequestBody Map<String, String> request) throws Exception {
        String input = request.get("input");
        String model = request.get("model");
        String network = request.get("network");
        TokenEncryptor.getToken(model,network,input);

        // 模拟 token 生成，需替换为实际逻辑
        return ResponseEntity.ok(UUID.randomUUID().toString());
    }

    public static void main(String[] args) {
        String s = new HttpUtils().sendHttpGet("https://open.emoon.com/Apis/search?publicKey=tHJZp9mJQPJ4CJAu19F6vhIVa1cyZhP8");
        System.out.println(s);

    }
}