<?php

namespace App\Notifications;

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

class FileSharedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $file;
    protected $sharedBy;

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

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

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