package com.cool.store.controller.webb;

import com.cool.store.enums.DeliveryPlanStageEnum;
import com.cool.store.enums.DeliveryStatusEnum;
import com.cool.store.request.plan.NotifyDeliveryRequest;
import com.cool.store.request.plan.UpdateDeliveryItemRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.plan.ShopDeliveryPlanService;
import com.cool.store.vo.plan.DeliveryDetailVO;
import com.cool.store.vo.plan.DeliveryInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 门店发货阶段控制器
 */
@RequestMapping("/pc/shopDeliveryPlan")
@RestController
@Api("门店发货阶段")
public class ShopDeliveryPlanController {

    @Resource
    private ShopDeliveryPlanService shopDeliveryPlanService;

    @PostMapping("/notifyDelivery")
    @ApiOperation("通知发货")
    public ResponseResult<Boolean> notifyDelivery(@RequestBody @Validated NotifyDeliveryRequest request) {
        return ResponseResult.success(shopDeliveryPlanService.notifyDelivery(request));
    }

    @GetMapping("/queryDeliveryInfo")
    @ApiOperation("查询发货信息")
    public ResponseResult<DeliveryInfoVO> queryDeliveryInfo(@RequestParam("shopId") Long shopId) {
        return ResponseResult.success(shopDeliveryPlanService.queryDeliveryInfo(shopId));
    }

    @PostMapping("/updateDeliveryItem")
    @ApiOperation("更新发货项信息")
    public ResponseResult<Boolean> updateDeliveryItem(@RequestBody @Validated UpdateDeliveryItemRequest request) {
        return ResponseResult.success(shopDeliveryPlanService.updateDeliveryItem(request));
    }

    @GetMapping("/queryDeliveryDetail")
    @ApiOperation("根据门店查询发货详细信息")
    public ResponseResult<DeliveryDetailVO> queryDeliveryDetail(@RequestParam("shopId") Long shopId) {
        return ResponseResult.success(shopDeliveryPlanService.queryDeliveryDetail(shopId));
    }
}
