import  { JobRepository } from '../../infrastructure/repositories/job.repository'
import { JobResponse } from '../../domain/models/profiles/JobResponse.interface'
import { TaskType } from '../models/tasks/enums/TaskType.enum';
import { JobsSummaryResponse } from '../models/jobs/JobsSummaryResponse.interface';
import { JobCountResponse } from '../models/jobs/JobCountResponse.interface';
import { Response } from '../../domain/models/Response.interface';
import { JobInfoResponse } from '../../domain/models/jobs/JobInfoResponse.interface';
export class JobService {
private jobRepository: JobRepository;
    constructor() {
        this.jobRepository = new JobRepository();
    }

    async submitJob(idTaskSelected : String): Promise<JobResponse>{
        const response = await this.jobRepository.submitJob(idTaskSelected);
        return response;
    }

    async getSummaryFromTask(taskType: TaskType): Promise<JobsSummaryResponse>{
        const response = await this.jobRepository.getSummaryFromTask(taskType);
        return response;
    }

    async getCountFromTask(taskType: TaskType): Promise<JobCountResponse>{
        const response = await this.jobRepository.getCount(taskType);
        return response;
    }

    async deleteJob(idJobSelected: String, taskType: TaskType): Promise<Response>{
        const response = await this.jobRepository.deleteJob(idJobSelected, taskType);
        return response;
    }

    async stopJob(idJobSelected: String): Promise<Response>{
        const response = await this.jobRepository.stopJob(idJobSelected);
        return response;
    }

    async getInfoJob(idJobSelected: String,taskType: TaskType): Promise<JobInfoResponse>{
        const response = await this.jobRepository.getInfoJob(idJobSelected, taskType);
        return response;
    }

    async getDetailJob(idJobSelected: String,taskType: TaskType): Promise<any>{
        const response = await this.jobRepository.getDetailJob(idJobSelected, taskType);
        return response;
    }

    async getStatisticsExecutionJob(taskType: TaskType = TaskType.All): Promise<any>{
        const response = await this.jobRepository.getStatisticsExecutionJob(taskType);
            return response;
    }

    async getQuestionsEvolve(idJobSelected: String){
        const response = await this.jobRepository.getQuestionsEvolve(idJobSelected);
        return response;
    }

    async saveQuestionsEvolve(idJobSelected: String, data: any ): Promise<any>{
        const response = await this.jobRepository.saveQuestionsEvolve(idJobSelected, data);
        return response;
    }

    async resumeJobEvolve(idJobSelected: String): Promise<any>{
        const response = await this.jobRepository.resumeJobEvolve(idJobSelected);
        return response;
    }

    async getSuggestedConfigs(idJobSelected: String): Promise<any>{
        const response = await this.jobRepository.getSuggestedConfigs(idJobSelected);
        return response;
    }
}