package shop.alien.store.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.entity.store.vo.StorePersonalCustomizedVo;
import shop.alien.store.service.StorePersonalCustomizedService;

/**
 * <p>
 * 个性化定制 前端控制器
 * </p>
 *
 * @author ssk
 * @since 2025-03-18
 */
@Api(tags = {"用户-个性化定制"})
@Slf4j
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/personalCustomized")
public class StorePersonalCustomizedController {

    private final StorePersonalCustomizedService storePersonalCustomizedService;

    @ApiOperation("创建个性化记录")
    @ApiOperationSupport(order = 1)
    @PostMapping("/createPersonalCustomizedRecord")
    public R<Boolean> createPersonalCustomizedRecord(@RequestBody StorePersonalCustomizedVo storePersonalCustomizedVo) {
        log.info("StorePersonalCustomizedController.createPersonalCustomizedRecord?storePersonalCustomizedVo={}", storePersonalCustomizedVo.toString());
        return R.data(storePersonalCustomizedService.createPersonalCustomizedRecord(storePersonalCustomizedVo));
    }

    @ApiOperation("查询个性化记录")
    @ApiOperationSupport(order = 2)
    @PostMapping("/getPersonalCustomizedList")
    public R<IPage<StorePersonalCustomizedVo>> getPersonalCustomizedList(@RequestBody StorePersonalCustomizedVo storePersonalCustomizedVo) {
        log.info("StorePersonalCustomizedController.getPersonalCustomizedList?storePersonalCustomizedVo={}", storePersonalCustomizedVo.toString());
        return R.data(storePersonalCustomizedService.getPersonalCustomizedList(storePersonalCustomizedVo));
    }

}
