package com.zbkj.front.controller;


import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.SetMealFloorProRequest;
import com.zbkj.common.request.SetMealFloorRequest;
import com.zbkj.common.request.SetMealRequest;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.response.SetMealResponse;
import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.vo.HomeVo;
import com.zbkj.service.service.EbHomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController("HomeController")
@RequestMapping("api/front")
@Api(tags = "楼层")
public class HomeController {

    @Autowired private EbHomeService homeService;

    @ApiOperation(value = "套餐导航列表-分页")
    @RequestMapping(value = "/setMeal/type", method = RequestMethod.GET)
    public CommonResult<CommonPage<SetMealResponse>> selectPageSetMealType(@Validated SetMealRequest entity, @Validated PageParamRequest page) {
        List<SetMealResponse> list = homeService.selectPageSetMealType(entity, page);
        return CommonResult.success(CommonPage.restPage(list));
    }

    @ApiOperation(value = "套餐楼层列表-分页")
    @RequestMapping(value = "/setMeal/floor", method = RequestMethod.GET)
    public CommonResult<CommonPage<HomeVo>> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) {
        List<HomeVo> list = homeService.selectPageSetMealFloor(entity, page);
        return CommonResult.success(CommonPage.restPage(list));
    }

    @ApiOperation(value = "套餐楼层商品-分页")
    @RequestMapping(value = "/setMeal/floor/pro", method = RequestMethod.GET)
    public CommonResult<CommonPage<HomeProductVo>> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) {
        List<HomeProductVo> list = homeService.selectPageSetMealFloorPro(entity, page);
        return CommonResult.success(CommonPage.restPage(list));
    }


}



