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

    async addEvolve(evolveRequest: Evolve): Promise<TaskResponse>{
        return await this.repository.post(process.env.VUE_APP_ROOT_API + '/tasks/evolve', evolveRequest);
    }

    async updateEvolve(evolveRequest: Evolve, idTask: string): Promise<TaskResponse>{
        return await this.repository.put(process.env.VUE_APP_ROOT_API + '/tasks/evolve/' + idTask, evolveRequest);
    }

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

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

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