<?php

namespace App\Notifications;

use App\Models\Application;
use App\Models\Payment;

class PaymentReceived extends ApplicationNotification
{
    public function __construct(Application $application, public Payment $payment)
    {
        parent::__construct($application);
    }

    protected function subject(): string
    {
        return 'Payment received - '.$this->application->application_number;
    }

    protected function heading(): string
    {
        return 'Payment confirmed';
    }

    protected function lines(): array
    {
        return [
            "We have received your application fee of {$this->payment->formattedAmount()}.",
            "Payment reference: {$this->payment->reference}",
            'You can now complete and submit your application.',
        ];
    }

    protected function actionLabel(): ?string
    {
        return 'Continue Application';
    }

    public function toSms(): ?string
    {
        return sprintf(
            'KCU: Payment of %s received for application %s. Ref %s',
            $this->payment->formattedAmount(),
            $this->application->application_number,
            $this->payment->reference,
        );
    }
}
