<?php

namespace App\Repositories\Contracts;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;

/**
 * @template T of Model
 */
interface BaseRepositoryInterface
{
    /**
     * @param  array<string, mixed>  $filters
     * @return LengthAwarePaginator<int, T>
     */
    public function paginate(array $filters = [], int $perPage = 15): LengthAwarePaginator;

    /**
     * @return T|null
     */
    public function findById(int $id): ?Model;

    /**
     * @param  array<string, mixed>  $data
     * @return T
     */
    public function create(array $data): Model;

    /**
     * @param  array<string, mixed>  $data
     * @return T
     */
    public function update(Model $model, array $data): Model;

    public function delete(Model $model): bool;
}
