import  { Repository } from '../../infrastructure/repositories/repository';
import { TaskResponse } from '../models/tasks/TaskResponse.interface';
import { Resolve } from '../models/resolve/Resolve.class';
import { TaskSummaryResponse } from '../models/tasks/TaskSummaryResponse.interface';
export class ResolveService {
    private repository: Repository;
    constructor(){
        this.repository = new Repository();
    }

    async addResolve(resolveRequest: Resolve): Promise<TaskResponse>{
        return await this.repository.post(process.env.VUE_APP_ROOT_API + '/tasks/resolve', resolveRequest);
    }

    async updateResolve(resolveRequest: Resolve, idTask: string): Promise<TaskResponse>{
        return await this.repository.put(process.env.VUE_APP_ROOT_API + '/tasks/resolve/' + idTask, resolveRequest);
    }

    async getResolveSummary():Promise<TaskSummaryResponse>{
        return await this.repository.get(process.env.VUE_APP_ROOT_API + '/tasks/resolve/summary');
    }

    async getResolve(idTask: string):Promise<TaskResponse>{
        return await this.repository.get(process.env.VUE_APP_ROOT_API + '/tasks/resolve/' + idTask);
    }

    async deleteResolveTask(idTask: string):Promise<Response>{
        return await this.repository.delete(process.env.VUE_APP_ROOT_API + '/tasks/resolve/' + idTask);
    }

    async getDataReportResolve(idJob: string){
        return await this.repository.get(process.env.VUE_APP_ROOT_API + '/jobs/results/resolve/stats/interval/' + idJob);
    }
}