package com.zbkj.front.controller;


import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.FloorProRequest;
import com.zbkj.common.request.FloorRequest;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.SetMealRequest;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.response.SetMealResponse;
import com.zbkj.common.vo.HomeItemVo;
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/home")
@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 = "/floor", method = RequestMethod.GET)
    public CommonResult<CommonPage<HomeVo>> selectPageFloor(@Validated FloorRequest entity, @Validated PageParamRequest page) {
        List<HomeVo> list = homeService.selectPageFloor(entity, page);
        return CommonResult.success(CommonPage.restPage(list));
    }

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


}



