<?php

namespace App\Modules\HR\Recruitment\Repositories;

use App\Modules\HR\Recruitment\Models\RecruitmentOfferLetterStatusEvent;
use Illuminate\Support\Collection;

class RecruitmentOfferLetterStatusEventRepository
{
    /** @param  array<string, mixed>  $data */
    public function create(array $data): RecruitmentOfferLetterStatusEvent
    {
        return RecruitmentOfferLetterStatusEvent::query()->create($data);
    }

    /** @return Collection<int, RecruitmentOfferLetterStatusEvent> */
    public function listForOffer(int $tenantId, int $offerLetterId): Collection
    {
        return RecruitmentOfferLetterStatusEvent::query()
            ->where('tenant_id', $tenantId)
            ->where('offer_letter_id', $offerLetterId)
            ->with('actor:id,name')
            ->orderBy('id')
            ->get();
    }
}
