<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Terminy\Listeners\Registracia;

use Seka\Portal\Modul\Terminy\Notifications\Registracia\VytvorenaRegistraciaNotifikacia;
use Seka\Portal\Modul\Terminy\Notifications\Registracia\ZrusenaRegistraciaNotifikacia;

/**
 * Class RegistraciaNotificationView
 *
 * @package Seka\Portal\Modul\Terminy\Listeners\Udalost
 */
final class RegistraciaNotificationView
{
    /**
     * @param $notification
     *
     * @return object|null
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function handle($notification): ?object
    {
        if (
            is_a(VytvorenaRegistraciaNotifikacia::class, $notification->type, true)
            || is_a(ZrusenaRegistraciaNotifikacia::class, $notification->type, true)
        ) {
            $obj = new \stdClass();
            $obj->name = 'Terminy::partials.notification-registracia';
            $obj->url = route('modul.terminy.frontend.registracie.pouzivatel.index');

            return $obj;
        }

        return null;
    }
}
