<?php

namespace App\Classes\Modules\Milestones\Services;

use App\Models\MilestoneProgress;

class CheckIfMilestoneProgressExists
{

    /** @var MilestoneProgress */
    private $repository;


    /**
     * CheckIfMilestoneProgressExists constructor.
     * @param MilestoneProgress $repository
     */
    public function __construct(MilestoneProgress $repository)
    {
        $this->repository = $repository;
    }

    public function execute(int $user_id, int $milestone_id): bool {
        return $this->repository->where('user_id', $user_id)->where('milestone_id', $milestone_id)->exists();
    }

}
