package com.persagy.dmp.delivery.client;

import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.model.QueryCriteria;
import com.persagy.dmp.common.model.response.CommonResult;
import com.persagy.dmp.delivery.dto.DeliveryPlanDTO;
import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
import org.springframework.cloud.openfeign.FeignClient;
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;

/**
 * 对象类型交付范围管理
 * @author Charlie Yu
 * @date 2021-05-15
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.rwd.service:}",path = "/rwd/def/class/collect")
public interface DigitalObjectTypeCollectClient {

    /**
     * 查询类型定义交付范围
     * @param groupCode 集团编码
     * @param projectId 项目ID
     * @param appId 应用ID
     * @param userId 用户ID
     * @param criteria 查询条件
     * @return 类型定义
     */
    @PostMapping("query")
    CommonResult<List<ObjectTypeCollect>> query(
            @RequestParam("groupCode") String groupCode,
            @RequestParam("projectId") String projectId,
            @RequestParam("appId") String appId,
            @RequestParam("userId") String userId,
            @RequestBody QueryCriteria criteria);

    /**
     * 新增对象类型交付范围-单个新增
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param vo: 新增对象类型对象
     * @return 对象类型对象
     */
    @PostMapping("create")
    CommonResult<ObjectTypeCollect> create(@RequestParam("groupCode") String groupCode,
                                          @RequestParam("projectId") String projectId,
                                          @RequestParam("appId") String appId,
                                          @RequestParam("userId") String userId,
                                          @RequestBody ObjectTypeCollect vo);

    /**
     * 生成项目交付范围
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param voList: 新增对象类型对象
     * @return 对象类型对象
     */
    @PostMapping("createProjDelivery")
    CommonResult<List<DeliveryPlanDTO>> createProjectDelivery(@RequestParam("groupCode") String groupCode,
                                                          @RequestParam("projectId") String projectId,
                                                          @RequestParam("appId") String appId,
                                                          @RequestParam("userId") String userId,
                                                          @RequestBody List<DeliveryPlanDTO> voList);

    /**
     * 新增对象类型交付范围-批量新增
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param voList: 新增对象类型对象数组
     * @return 对象类型对象数组
     */
    @PostMapping("createBatch")
    CommonResult<List<ObjectTypeCollect>> createBatch(@RequestParam("groupCode") String groupCode,
                                                     @RequestParam("projectId") String projectId,
                                                     @RequestParam("appId") String appId,
                                                     @RequestParam("userId") String userId,
                                                     @RequestBody List<ObjectTypeCollect> voList);
    /**
     * 更新对象类型交付范围-单个更新
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param vo: 更新对象类型对象
     * @return 对象类型对象
     */
    @PostMapping("update")
    CommonResult<ObjectTypeCollect> update(@RequestParam("groupCode") String groupCode,
                                          @RequestParam("projectId") String projectId,
                                          @RequestParam("appId") String appId,
                                          @RequestParam("userId") String userId,
                                          @RequestBody ObjectTypeCollect vo);
    /**
     * 更新对象类型交付范围-批量更新
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param voList: 更新对象类型对象数组
     * @return 对象类型对象数组
     */
    @PostMapping("updateBatch")
    CommonResult<List<ObjectTypeCollect>> updateBatch(@RequestParam("groupCode") String groupCode,
                                                     @RequestParam("projectId") String projectId,
                                                     @RequestParam("appId") String appId,
                                                     @RequestParam("userId") String userId,
                                                     @RequestBody List<ObjectTypeCollect> voList);
    /**
     * 删除对象类型交付范围-单个删除
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param id: 对象类型id
     * @return void
     */
    @PostMapping("delete")
    CommonResult<Void> delete(@RequestParam("groupCode") String groupCode,
                              @RequestParam("projectId") String projectId,
                              @RequestParam("appId") String appId,
                              @RequestParam("userId") String userId,
                              @RequestBody String id);
    /**
     * 删除对象类型交付范围-批量删除
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param ids: 对象类型id数组
     * @return void
     */
    @PostMapping("deleteBatch")
    CommonResult<Void> deleteBatch(@RequestParam("groupCode") String groupCode,
                                   @RequestParam("projectId") String projectId,
                                   @RequestParam("appId") String appId,
                                   @RequestParam("userId") String userId,
                                   @RequestBody List<String> ids);
}
