package com.prolog.upcloud.base.wh.operate.resource;

import com.prolog.cs.basic.item.model.BaseMtlItemMst;
import com.prolog.cs.basic.item.model.vo.*;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

@FeignClient(value = "${prolog.service.item}")
public interface ItemResource {

    /**
     * 查询商品
     *
     * @param itemId 商品编码
     * @return
     */
    @GetMapping("/item")
    RestMessage<BaseMtlItemMst> item(@RequestParam("itemId") String itemId);

    /**
     * 根据id查询商品主表信息
     *
     * @param itemId
     * @return
     */
    @GetMapping("/item/item-byid")
    RestMessage<BaseMtlItemMst> getItemById(@RequestParam("itemId") String itemId);

    /**
     * 根据id集合查询商品Map
     *
     * @param itmeIds
     * @return
     */
    @PostMapping("/item/mapbyids")
    RestMessage<Map<String, BaseMtlItemMst>> getMapByIds(@RequestBody Set<String> itmeIds);

    /**
     * 查询商品
     *
     * @param queryVO 查询条件
     * @return
     */
    @PostMapping("/item/pagebybiz")
    RestMessage<Page<ItemMstVO>> pagebybiz(ItemMstQueryVO queryVO);

    /**
     * 批量查询商品基础信息
     *
     * @return 商品基础信息
     */
    @GetMapping("/item/base/list")
    RestMessage<List<ItemBaseInfoVO>> getItemBaseList(@RequestParam("itemIds") String[] itemIds);


    /**
     * 根据条码或助记码查询商品基础信息
     *
     * @param itemCode 条码或助记码
     * @return 商品基础信息
     */
    @GetMapping("/item/base/info")
    public RestMessage<List<ItemBaseInfoVO>> getItemBaseInfoByCode(@RequestParam("code") String code, @RequestParam("itemCode") String itemCode);

    /**
     * 查询商品及其重要关联信息
     */
    @PostMapping("/item/listbyRelated")
    public RestMessage<List<ItemMstVO2>> listByRelated(@RequestBody ItemMstQueryVO vo);

    @PostMapping("/item/listbyids")
    RestMessage<List<BaseMtlItemMst>> getListByIds(@RequestBody Set<String> itmeIds);

    @PostMapping( "/item/wave/listbyids")
    RestMessage<List<WaveItemInfoVO>> getWaveItemInfo(@RequestBody List<String> ids);
}
