<?php

declare(strict_types=1);

namespace App\Notifications;

use App\Models\Question;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

final class QuestionAnswered extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     */
    public function __construct(private Question $question) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['database'];
    }

    /**
     * Get the array representation of the notification.
     *
     * @return array<string, mixed>
     */
    public function toDatabase(object $notifiable): array
    {
        return [
            'question_id' => $this->question->id,
        ];
    }
}
