package org.jeecg.yw.java;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.yw.spark.analysis$;
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;

@RestController
@RequestMapping("/analysis")
public class index {
    @RequestMapping("/data")
    public Result getData(@RequestBody Map<String, Object> map) {
        JSONObject json = new JSONObject();
        json.put("healthScore", analysis$.MODULE$.getScore(map));
        json.put("foodRecommendations", analysis$.MODULE$.getResult(map));
        return Result.ok(json);
    }

    @RequestMapping("/ml")
    public Result getScore(@RequestBody Map<String, Object> map) {
        JSONObject json = new JSONObject();
        json.put("ML", analysis$.MODULE$.getML(map));
        return Result.ok(json);
    }
}
