<?php

namespace App\Notifications;

use App\Models\MarketingRequest;
use App\Models\RevisionRequest;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class RevisionRequestedNotification extends Notification
{
    use Queueable;

    public MarketingRequest $request;
    public RevisionRequest $revision;

    public function __construct(MarketingRequest $request, RevisionRequest $revision)
    {
        $this->request = $request;
        $this->revision = $revision;
    }

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

    public function toArray(object $notifiable): array
    {
        return [
            'request_id' => $this->request->id,
            'request_number' => $this->request->request_number,
            'title' => "Revision #{$this->revision->revision_number} Requested",
            'message' => "Changes requested on {$this->request->request_number}: \"{$this->revision->feedback}\"",
            'url' => route('requests.show', $this->request->id),
            'type' => 'revision_requested',
        ];
    }
}
