package com.YuyeTech.HeartRate.game.foodRecommend.controller;

import com.YuyeTech.HeartRate.VO.ResultVO;
import com.YuyeTech.HeartRate.common.controller.*;
import com.YuyeTech.HeartRate.common.pojo.PageInfo;
import com.YuyeTech.HeartRate.enums.FoodEnum;
import com.YuyeTech.HeartRate.game.foodRecommend.pojo.FoodRecommend;
import com.YuyeTech.HeartRate.game.foodRecommend.vo.FoodRecommendVo;
import com.YuyeTech.HeartRate.game.foodRecommend.service.FoodRecommendService;
import com.YuyeTech.HeartRate.utils.ResultVOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/foodRecommend/")
public class FoodRecommendController extends CommonController<FoodRecommendVo, FoodRecommend, Integer> {
    @Autowired
    private FoodRecommendService foodRecommendService;

    /**
     *  获取分类
     * @return
     */
    @GetMapping(value = "/types")
    public ResultVO onGetTypes(){
        List<HashMap<String, Object>> list = new ArrayList<>();
        for (FoodEnum foodEnumEnum : EnumSet.allOf(FoodEnum.class)) {
            HashMap<String, Object> map = new HashMap<>();
            map.put("name", foodEnumEnum.getName());
            map.put("value", foodEnumEnum.getValue());
            list.add(map);
        }
        return  ResultVOUtil.success(list);
    }


}
