package com.ylx.home.category.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylx.common.core.domain.R;
import com.ylx.home.category.domain.dto.MerchantsDto;
import com.ylx.home.category.domain.dto.MerchantRecommendDto;
import com.ylx.home.category.domain.dto.ProjectRecommendDTO;
import com.ylx.home.category.domain.vo.MerchantsVo;
import com.ylx.home.category.domain.vo.ProjectRecommendVo;
import com.ylx.massage.domain.vo.MerchantVo;
import com.ylx.massage.service.IMassageRecommendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述：按摩推荐
 *
 * @author Administrator
 * @version 1.0
 * @date 2026/6/2 16:36
 */
@Slf4j
@RestController
@Api(tags = {"首页类目推荐"})
@RequestMapping("/home/category")
public class CategoryRecommendController {

    @Resource
    private IMassageRecommendService massageRecommendService;

    @ApiOperation(value = "商户推荐", notes = "商户推荐")
    @PostMapping(value = "/merchant/recommend")
    public R<List<MerchantVo>> merchantRecommend(@Validated @RequestBody MerchantRecommendDto dto) {
        List<MerchantVo> massageRecommendVos = massageRecommendService.getMerchantRecommend(dto);
        return R.ok(massageRecommendVos);
    }

    @ApiOperation(value = "项目推荐", notes = "项目推荐")
    @PostMapping(value = "/project/recommend")
    public R<Page<ProjectRecommendVo>> projectRecommend(@Validated @RequestBody ProjectRecommendDTO dto) {
        Page<ProjectRecommendVo> page = new Page<>(dto.getCurrent(), dto.getSize());
        return R.ok(massageRecommendService.getProjectRecommend(page, dto));
    }

    @ApiOperation(value = "推荐商户点击全部查询所有商户", notes = "推荐商户点击全部查询所有商户")
    @PostMapping(value = "/merchants")
    public R<Page<MerchantsVo>> merchants(@Validated @RequestBody MerchantsDto dto) {
        Page<MerchantsVo> page = new Page<>(dto.getCurrent(), dto.getSize());
        return R.ok(massageRecommendService.getMerchants(page, dto));
    }


}