package com.friday.distributor.frame;

import com.friday.base.common.response.DubboResult;
import com.friday.distributor.bean.Job;
import com.friday.distributor.bean.TaieJobExecInfo;
import com.friday.operation.api.distributor.constant.TaieJobState;
import com.friday.operation.api.distributor.dto.TaskResultDto;
import org.springframework.stereotype.Service;

/**
 * @Author YaoYao
 * @Date Created In 11:32 2022/2/24
 * @Description AI运行相关
 * @Modified By
 */
@Service("AIExecFrameService")
public class AIExecFrameService implements IBizTypeStrategyContext{

    @Override
    public DubboResult<String> asyncStartTaieJob(Job job) {
        return DubboResult.newSuccess("1");
    }

    @Override
    public DubboResult<TaskResultDto> syncStartTaieJob(Job job) {
        return DubboResult.newSuccess(new TaskResultDto());
    }

    @Override
    public DubboResult stopTaieJob(Job job) {
        return DubboResult.newSuccess();
    }

    @Override
    public DubboResult<TaieJobExecInfo> getTaieJobExecDetail(Job job) {
        TaieJobExecInfo taieJobExecInfo = TaieJobExecInfo.builder()
                .invokeId(job.getInvokeId())
                .execJobId(job.getExecJobId())
                .jobState(TaieJobState.Success.getState())
                .build();
        return DubboResult.newSuccess(taieJobExecInfo);
    }
}
