<?php

namespace App\Http\Controllers\API\V1\Pouzivatel\Notifications\Transformers;

use Illuminate\Notifications\DatabaseNotification;
use League\Fractal\TransformerAbstract;

/**
 *
 */
class NotificationTransformer extends TransformerAbstract
{
    /**
     * @param DatabaseNotification $notification
     * @return array
     */
    public function transform(DatabaseNotification $notification): array
    {
        return [
            'id' => $notification->id,
            'type' => $notification->type,
            'notifiable_type' => $notification->notifiable_type,
            'notifiable_id' => $notification->notifiable_id,
            'data' => $notification->data,
            'read_at' => $notification->read_at,
            'created_at' => $notification->created_at,
            'updated_at' => $notification->updated_at,
            'links'   => [
                'self' => null
            ],
        ];
    }
}
