package com.friday.tooldriver.service.strategy;

import com.friday.base.common.response.DubboResult;
import com.friday.operation.api.tooldriver.dto.common.DriverBase;
import com.friday.operation.api.tooldriver.dto.rpa.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author YaoYao
 * @Date Created In 18:27 2022/12/1
 * @Description Rpa驱动行为接口
 * @Modified By
 */
public interface ICapabilityDriverService {
    /**
     * 租户管理
     */

    //创建租户
    DubboResult<TenantDto> createTenant(DriverBase driverBase, TenantDto tenant);

    //查询租户
    DubboResult<ArrayList<TenantDto>> queryTenants(DriverBase driverBase, TenantSelectFilter filter);

    //根据key查询租户
    DubboResult<TenantDto> queryTenantByKey(DriverBase driverBase, String key);

    //根据key删除租户
    DubboResult deleteTenantByKey(DriverBase driverBase, String key);

    //根据key更新租户
    DubboResult updateTenantByKey(DriverBase driverBase, String key);

    //根据key激活租户
    DubboResult activateTenantByKey(DriverBase driverBase, String key);


    /**
     * 组管理
     */

    //创建组
    DubboResult<GroupDto> createGroup(DriverBase driverBase, GroupDto group);

    //查询组
    DubboResult<ArrayList<GroupDto>> queryGroups(DriverBase driverBase, GroupFilter filter);

    //根据key查询组
    DubboResult<GroupDto> queryGroupByKey(DriverBase driverBase, String key);

    //根据key删除组
    DubboResult deleteGroupByKey(DriverBase driverBase, String key);


    /**
     * 流程管理
     */

    //上传代码包
    DubboResult<CodePackageDto> uploadPackage(DriverBase driverBase, CodePackageDto pkg);

    //根据key删除代码包
    DubboResult deletePackageByKey(DriverBase driverBase, String key);

    //查询代码包
    DubboResult<ArrayList<CodePackageDto>> queryPackages(DriverBase driverBase, CodePackageFilter filter);

    //根据key查询代码包
    DubboResult<CodePackageDto> queryPackageByKey(DriverBase driverBase, String key);

    //根据key下载代码包
    DubboResult<FileInfoDto> downloadPackageByKey(DriverBase driverBase, String key, String fileName);

    //发布流程
    DubboResult<ReleaseDto> releaseProcess(DriverBase driverBase, ReleaseDto release);

    //根据key删除流程
    DubboResult deleteProcessReleaseByKey(DriverBase driverBase, String key);

    //查询流程
    DubboResult<ArrayList<ReleaseDto>> queryProcessReleases(DriverBase driverBase, ReleaseFilter filter);

    //根据key查询流程
    DubboResult<ReleaseDto> queryProcessReleaseByKey(DriverBase driverBase, String key);


    /**
     * 机器人管理
     */

    //创建机器人
    DubboResult<RobotDto> createRobot(DriverBase driverBase, RobotDto robot);

    //根据key删除机器人
    DubboResult deleteRobotByKey(DriverBase driverBase, String key);

    //查询机器人
    DubboResult<ArrayList<RobotDto>> queryRobots(DriverBase driverBase, RobotFilter filter);

    //根据key查询机器人
    DubboResult<RobotDto> queryRobotByKey(DriverBase driverBase, String key);

    //将机器人加进组
    DubboResult assignRobotToGroup(DriverBase driverBase, String robotKey, String groupKey);

    //将机器人移出组
    DubboResult removeRobotFromGroup(DriverBase driverBase, String robotKey, String groupKey);

    /**
     * 许可管理
     */

    //颁发许可
    DubboResult enableLicense(DriverBase driverBase, LicenseDto license);

    //回收许可
    DubboResult disableLicense(DriverBase driverBase, LicenseDto license);

    //查询可用许可数量
    DubboResult<Integer> availableLicenseNum(DriverBase driverBase, String licenseType);


    /**
     * 运行管理
     */

    //启动任务
    DubboResult<JobDto> startJob(DriverBase driverBase, StartJobDto start);

    //重启任务
    DubboResult<JobDto> restartJob(DriverBase driverBase, String jobId);

    //暂停任务
    DubboResult pauseJob(DriverBase driverBase, String jobId);

    //继续任务
    DubboResult resumeJob(DriverBase driverBase, String jobId);

    //终止任务
    DubboResult stopJob(DriverBase driverBase, String jobId);

    //批量终止任务
    DubboResult stopJobs(DriverBase driverBase, List<String> jobIdList);

    //查询任务
    DubboResult<ArrayList<JobDto>> queryJobs(DriverBase driverBase, JobFilter filter);

    //根据Key查询任务详情
    DubboResult<JobDto> queryJobByKey(DriverBase driverBase, String jobId);

}
