<?php

declare(strict_types=1);

namespace App\Services\Leave;

use App\Enums\ApprovalStatus;
use App\Models\UnpaidLeave;
use App\Models\User;

class UnpaidLeaveService
{
    public function approve(UnpaidLeave $unpaidLeave, User $approver): void
    {
        $unpaidLeave->update([
            'status' => ApprovalStatus::Approved,
            'approved_by' => $approver->id,
            'approved_at' => now(),
        ]);
    }

    public function reject(UnpaidLeave $unpaidLeave, User $approver): void
    {
        $unpaidLeave->update([
            'status' => ApprovalStatus::Rejected,
            'approved_by' => $approver->id,
            'approved_at' => now(),
        ]);
    }
}
