<?php

namespace App\Notifications;

use App\Enums\ApplicationStatus;
use App\Models\Application;

class ApplicationStatusUpdated extends ApplicationNotification
{
    public function __construct(Application $application, public ApplicationStatus $newStatus)
    {
        parent::__construct($application);
    }

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

    protected function heading(): string
    {
        return 'Your application has been updated';
    }

    protected function lines(): array
    {
        return [
            "Application {$this->application->application_number} is now: {$this->newStatus->applicantLabel()}.",
            'Sign in to your applicant portal for the full details.',
        ];
    }

    public function toSms(): ?string
    {
        return sprintf(
            'KCU: Application %s is now %s.',
            $this->application->application_number,
            $this->newStatus->applicantLabel(),
        );
    }
}
