package cn.axzo.workflow.client.feign.manage;

import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
import cn.axzo.workflow.common.annotation.InvokeMode;
import cn.axzo.workflow.common.annotation.Manageable;
import cn.axzo.workflow.common.model.request.admin.ProcessAdminCreateDTO;
import cn.axzo.workflow.common.model.request.admin.ProcessAdminDeleteDTO;
import cn.axzo.workflow.common.model.request.admin.ProcessAdminQueryDTO;
import cn.axzo.workflow.common.model.response.admin.ProcessAdminVo;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
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 static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;

@WorkflowEngineFeignClient
@Manageable
public interface ProcessAdminApi {

    /**
     * 查询管理员
     * @param dto 管理员数据
     * @return 管理员id
     */
    @PostMapping("/api/process/admin/query")
    @InvokeMode(SYNC)
    CommonResponse<List<ProcessAdminVo>> queryProcessAdmins(@RequestBody ProcessAdminQueryDTO dto);

    /**
     * 查询管理员
     * @param dto 管理员数据
     * @return 管理员id
     */
    @PostMapping("/api/process/admin/query/count")
    @InvokeMode(SYNC)
    CommonResponse<Integer> queryProcessAdminsCount(@RequestBody ProcessAdminQueryDTO dto);

    /**
     * 添加管理员
     * @param dto 管理员数据
     * @return 管理员id
     */
    @PostMapping("/api/process/admin/create")
    @InvokeMode(SYNC)
    CommonResponse<Long> createProcessAdmin(@RequestBody ProcessAdminCreateDTO dto);

    /**
     * 批量添加管理员
     * @param dtos
     * @return
     */
    @PostMapping("/api/process/admin/batch/create")
    @InvokeMode(SYNC)
    CommonResponse<Void> batchCreateProcessAdmin(@RequestBody List<ProcessAdminCreateDTO> dtos);

    /**
     * 删除管理员
     * @param id 配置表id
     * @return
     */
    @DeleteMapping("/api/process/admin/delete")
    @InvokeMode(SYNC)
    CommonResponse<Integer> deleteCommonProcessAdmin(@RequestParam Long id);

    /**
     * 根据条件删除管理员
     * @param dto 删除条件
     * @return
     */
    @DeleteMapping("/api/process/admin/delete/criteria")
    @InvokeMode(SYNC)
    CommonResponse<Integer> deleteProcessAdminCriteria(@RequestBody ProcessAdminDeleteDTO dto);

    /**
     * 删除管理员
     * @param ids 管理员配置id列表
     * @return
     */
    @DeleteMapping("/api/process/admin/batch/delete")
    @InvokeMode(SYNC)
    CommonResponse<Integer> batchDeleteProcessAdmin(@RequestBody List<Long> ids);
}
