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.entity.RelationDefineCollect;
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;

/**
 * 关系交付范围Client
 * @author Charlie Yu
 * @date 2021-05-15
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.rwd.service:}",path = "/rwd/def/rel/collect")
public interface DigitalRelationDefineCollectClient {

    /**
     * 查询关系交付范围
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param criteria: 查询条件
     * @return 关系交付范围数组
     */
    @PostMapping("query")
    CommonResult<List<RelationDefineCollect>> 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<RelationDefineCollect> create(@RequestParam("groupCode") String groupCode,
                                     @RequestParam("projectId") String projectId,
                                     @RequestParam("appId") String appId,
                                     @RequestParam("userId") String userId,
                                     @RequestBody RelationDefineCollect vo);
    /**
     * 更新关系交付范围-单个更新
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param vo: 更新关系交付范围对象
     * @return 关系交付范围对象
     */
    @PostMapping("update")
    CommonResult<RelationDefineCollect> update(@RequestParam("groupCode") String groupCode,
                                     @RequestParam("projectId") String projectId,
                                     @RequestParam("appId") String appId,
                                     @RequestParam("userId") String userId,
                                     @RequestBody RelationDefineCollect vo);
    /**
     * 删除关系交付范围-单个删除
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param id: 关系交付范围id
     * @return void
     */
    @PostMapping("delete")
    CommonResult<RelationDefineCollect> delete(@RequestParam("groupCode") String groupCode,
                                     @RequestParam("projectId") String projectId,
                                     @RequestParam("appId") String appId,
                                     @RequestParam("userId") String userId,
                                     @RequestBody String id);

}
