import { TaskUpdate } from "../models/taskUpdate";
import { IDataService } from "../services/data/IDataService";
import { IRepository } from "./IRepository";

export class TaskUpdateRepository implements IRepository<TaskUpdate> {
    private dataService: IDataService<TaskUpdate>;

    constructor(dataService: IDataService<TaskUpdate>) {
        this.dataService = dataService;
    }

    async create(item: TaskUpdate): Promise<TaskUpdate> {
        return this.dataService.create(item);
    }

    async findById(id: number): Promise<TaskUpdate | null> {
        return this.dataService.findById(id);
    }

    async findAll(): Promise<TaskUpdate[]> {
        return this.dataService.findAll();
    }

    async update(id: number, item: Partial<TaskUpdate>): Promise<TaskUpdate | null> {
        return this.dataService.update(id, item);
    }

    async delete(id: number): Promise<boolean> {
        return this.dataService.delete(id);
    }
}