
package com.tmerclub.cloud.product.service;

import com.tmerclub.cloud.common.order.vo.WarehouseVO;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.api.product.dto.WarehouseDTO;
import com.tmerclub.cloud.common.product.vo.StockPointVO;

import java.util.List;

/**
 * @author tmerclub
 * @date 2023-11-08 11:11:44
 */
public interface WarehouseService {

    /**
     * 分页获取列表
     *
     * @param pageDTO      分页参数
     * @param warehouseDTO 查询参数
     * @return 列表分页数据
     */
    PageVO<WarehouseVO> page(PageDTO pageDTO, WarehouseDTO warehouseDTO);

    /**
     * 根据id获取
     *
     * @param warehouseId id
     * @return
     */
    WarehouseVO getByWarehouseId(Long warehouseId);

    /**
     * 保存
     *
     * @param warehouse
     */
    void insertWarehouseAndArea(WarehouseDTO warehouse);

    /**
     * 更新
     *
     * @param warehouse
     */
    void updateWarehouseAndArea(WarehouseDTO warehouse);

    /**
     * 根据id删除
     *
     * @param warehouseId id
     * @return
     */
    WarehouseVO deleteWarehouseAndArea(Long warehouseId);

    /**
     * 根据id清除缓存
     *
     * @param warehouseId 仓库id
     * @param shopId      店铺id
     * @param sysType     系统类型
     */
    void removeWarehouseCache(Long warehouseId, Long shopId, Integer sysType);

    /**
     * 根据shopId创建默认仓库
     *
     * @param shopId
     * @param sysType
     * @param phone
     * @param name
     */
    void createWarehouseByShopId(Long shopId, Integer sysType, String phone, String name);

    /**
     * 根据店铺id获取所有的供货城市id
     *
     * @param shopId
     * @param sysType
     * @param warehouseId
     * @return
     */
    List<Long> listWarehouseAreaByShopId(Long shopId, Integer sysType, Long warehouseId);

    /**
     * 获取仓库集合
     *
     * @param warehouseDTO 仓库dto
     * @return 仓库集合
     */
    List<WarehouseVO> listWarehouse(WarehouseDTO warehouseDTO);

    /**
     * 获取可配送仓库集合
     * @param warehouseDTO 仓库dto
     * @return 仓库集合
     */
    List<WarehouseVO> listCanDeliveryWarehouse(WarehouseDTO warehouseDTO);

    /**
     * 获取商家的默认仓库id
     *
     * @param shopId
     * @param sysType
     * @return
     */
    WarehouseVO getDefaultWarehouseByShopId(Long shopId, Integer sysType);

    /**
     * 获取店铺的所有仓库列表
     *
     * @param shopId
     * @param sysType
     * @return
     */
    List<WarehouseVO> listWarehouseByShopId(Long shopId, Integer sysType);

    /**
     * 初始化默认仓库
     */
    void intiWarehouse();

    /**
     * 获取默认仓库集合
     * @return 仓库集合
     */
    List<WarehouseVO> listDefaultWarehouses();

    /**
     * 根据店铺id和类型获取库存点数据
     * @param shopId
     * @param sysType
     * @return
     */
    StockPointVO getWarehousePoint(Long shopId, Integer sysType);
}
