<?php

namespace Modules\Notification\Resources\Api;

use Illuminate\Http\Resources\Json\JsonResource;

class NotificationResource extends JsonResource
{

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => (int) $this->id,
            'title' => $this->currentDescription->title ?? "",
            'description' => $this->currentDescription->description ?? "",
            'date' => $this->getDateAttribute(),
            'time' => $this->getTimeAttribute(),
        ];
    }

}
