<?php

namespace App\Notifications;

use App\Models\Contribution;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class ContributionReceiptNotification extends Notification
{
    use Queueable;

    public function __construct(public Contribution $contribution) {}

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)->subject('Ajo contribution receipt '.$this->contribution->receipt_number)
            ->greeting('Hello '.$this->contribution->member->full_name)
            ->line('Your contribution of NGN '.number_format($this->contribution->amount_paid / 100, 2).' for '.$this->contribution->group->name.' has been recorded.')
            ->line('Receipt: '.$this->contribution->receipt_number)->line('Thank you.');
    }
}
