<?php

namespace Modules\Admin\Services;

use Illuminate\Pagination\LengthAwarePaginator;
use Modules\Admin\Repositories\Interfaces\WeeklySpecialRepositoryInterface;

class WeeklySpecialService
{
    public function __construct(
        private WeeklySpecialRepositoryInterface $weeklySpecialRepository
    ) {}

    public function getAll(int $perPage = 10): LengthAwarePaginator
    {
        return $this->weeklySpecialRepository->paginate($perPage);
    }

    public function findById(int $id): ?\Modules\WeeklySpecial\Models\WeeklySpecial
    {
        return $this->weeklySpecialRepository->find($id);
    }

    public function create(array $data): \Modules\WeeklySpecial\Models\WeeklySpecial
    {
        return $this->weeklySpecialRepository->create($data);
    }

    public function update(int $id, array $data): \Modules\WeeklySpecial\Models\WeeklySpecial
    {
        return $this->weeklySpecialRepository->update($id, $data);
    }

    public function delete(int $id): bool
    {
        return $this->weeklySpecialRepository->delete($id);
    }
}
