<?php

namespace App\EventHooks\Invoice;

use App\EventHooks\HookEvent;
use App\Models\Invoice;

/**
 * Fire noktası: ApplyLateFeesCommand → AddInvoiceLateFee (buildInvoiceContext + amount + fee)
 * Context: invoice (model), invoice_id, status, amount, fee.
 */
class InvoiceLateFeeAdded extends HookEvent
{
    public const HOOK = 'AddInvoiceLateFee';

    public function invoice(): ?Invoice
    {
        $i = $this->get('invoice');
        if ($i instanceof Invoice) {
            return $i;
        }
        $id = $this->get('invoice_id');

        return $id ? Invoice::find($id) : null;
    }

    public function amount(): mixed
    {
        return $this->get('amount');
    }

    public function fee(): mixed
    {
        return $this->get('fee');
    }
}
