<?php

namespace App\Notifications;

use App\Models\FnfSettlement;

class FnfPaidNotification 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 paid';
    }

    public function notificationLines(): array
    {
        return [
            'Your full and final settlement has been marked as paid.',
            'Net amount: ₹' . number_format((float) $this->settlement->net_payable, 2),
            'Your employment account has been deactivated. You can download the F&F summary from the worksheet.',
        ];
    }

    public function actionUrl(): ?string
    {
        return route('fnf.download', $this->settlement);
    }

    public function actionLabel(): string
    {
        return 'Download F&F PDF';
    }

    public function toArray(object $notifiable): array
    {
        return [
            'type' => 'fnf_paid',
            'message' => 'Your F&F settlement was marked paid. Net: ₹' . 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),
        ];
    }
}
