<?php

namespace App\Notifications;

use App\Models\FnfSettlement;

class FnfApprovedNotification extends HrmsNotification
{
    public function __construct(
        public FnfSettlement $settlement
    ) {}

    public function notificationCategory(): string
    {
        return 'fnf';
    }

    public function notificationSubject(): string
    {
        return 'Your F&F settlement has been approved';
    }

    public function notificationLines(): array
    {
        return [
            'Your full and final settlement has been approved.',
            'Net payable: ₹' . number_format((float) $this->settlement->net_payable, 2),
            'Finance will process the payment shortly.',
        ];
    }

    public function actionUrl(): ?string
    {
        return route('fnf.show', $this->settlement);
    }

    public function actionLabel(): string
    {
        return 'View F&F worksheet';
    }

    public function toArray(object $notifiable): array
    {
        return [
            'type' => 'fnf_approved',
            'message' => 'Your F&F settlement was approved. Net payable: ₹' . number_format((float) $this->settlement->net_payable, 2),
            'fnf_id' => $this->settlement->id,
            'net_payable' => $this->settlement->net_payable,
            'url' => route('fnf.show', $this->settlement),
        ];
    }
}
