package com.yami.shop.api.controller;

import com.yami.shop.bean.app.param.QnhPushParam;
import com.yami.shop.common.util.R;
import com.yami.shop.service.IQnhService;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 千牛汇信息管理实现
 *
 * @author wy
 * @version 1.0.0
 * @since 2025-01-01
 */
@RestController
@RequestMapping("/qnh")
public class QnhController {

    @Resource
    private IQnhService qnhService;

    @ApiOperation("牵牛花推送")
    @PostMapping("/data/update")
    public R<String> dataUpdate(@RequestBody QnhPushParam qnhPushParam) {
        return R.SUCCESS(qnhService.dataUpdate(qnhPushParam));
    }

    @ApiOperation("手动触发数据同步")
    @GetMapping("/data/synchronizedInfo")
    public void synchronizedInfo() {
         qnhService.synchronizedInfo();
    }
//    @ApiOperation("更新库存")
//    @GetMapping("/getSkuStock")
//    public ResponseEntity<Boolean> getSkuStock(@RequestParam String skuCode,@RequestParam Long prodId) {
//        qnhService.getSkuStock(skuCode,prodId);
//        return ResponseEntity.ok(true);
//    }
    @ApiOperation("被动接受库存商品信息")
    @PostMapping("/data/noticeProductInfo")
    public ResponseEntity<String> noticeProductInfo(@RequestBody Object object) {
        qnhService.noticeProductInfo(object);
        return ResponseEntity.ok("success");
    }

}
