<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\DatabaseMessage;

class FolderSharedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $folder;
    protected $sharedBy;

    public function __construct($folder, $sharedBy)
    {
        $this->folder = $folder;
        $this->sharedBy = $sharedBy;
    }

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

    public function toDatabase($notifiable)
    {
        return [
            'title' => 'Folder Shared with You',
            'body' => $this->sharedBy . ' shared the folder "' . $this->folder->name . '" with you.',
            'folder_id' => $this->folder->id,
            'shared_by' => $this->sharedBy,
        ];
    }
}
