<?php

namespace App\Repositories;

use App\Models\ActivityLog;
use Illuminate\Database\Eloquent\Builder;

class ActivityLogRepository
{
    protected ActivityLog $model;

    public function __construct(ActivityLog $model)
    {
        $this->model = $model;
    }

    public function query(): Builder
    {
        return $this->model->newQuery()->with('user');
    }

    public function find(int $id): ?ActivityLog
    {
        return $this->model->find($id);
    }

    public function delete(int $id): bool
    {
        $record = $this->find($id);
        if (! $record) {
            return false;
        }

        return $record->delete();
    }
}
