<?php

use Diglactic\Breadcrumbs\Breadcrumbs;
use Seka\Portal\Modul\Terminy\Entities\Udalost\Udalost;

/**
 * Terminy
 */
Breadcrumbs::for('modul.terminy.frontend.index', function ($trail) {
    $trail->parent('portal.plocha');
    $trail->push('Termíny', route('modul.terminy.frontend.index'));
});

/**
 * Terminy -> Udalosti
 */
Breadcrumbs::for('modul.terminy.frontend.udalosti.index', function ($trail) {
    $trail->parent('modul.terminy.frontend.index');
    $trail->push('Udalosti', route('modul.terminy.frontend.udalosti.index'));
});

/**
 * Terminy -> Udalosti -> Udalost
 */
Breadcrumbs::for('modul.terminy.frontend.udalosti.udalost.show', function ($trail, $mtUdalostId) {
    /** @var Udalost $udalost */
    $udalost = Udalost::query()->findOrFail($mtUdalostId);
    $trail->parent('modul.terminy.frontend.udalosti.index');
    $trail->push(ucfirst($udalost->druh->label), route('modul.terminy.frontend.udalosti.udalost.show', $udalost));
});

Breadcrumbs::for('modul.terminy.frontend.registracie.pouzivatel.selectOptions', function ($trail, $mtUdalostId) {
    /** @var Udalost $udalost */
    $udalost = Udalost::query()->findOrFail($mtUdalostId);
    $trail->parent('modul.terminy.frontend.udalosti.udalost.show', $mtUdalostId);
    $trail->push('Voľba možností registrácie', route('modul.terminy.frontend.registracie.pouzivatel.selectOptions', $udalost));
});

/**
 * Terminy -> Moje registracie
 */
Breadcrumbs::for('modul.terminy.frontend.registracie.pouzivatel.index', function ($trail) {
    $trail->parent('modul.terminy.frontend.index');
    $trail->push('Moje registrácie', route('modul.terminy.frontend.registracie.pouzivatel.index'));
});

/**
 * Terminy -> Udalosti -> Udalost -> Registracie
 */
Breadcrumbs::for('modul.terminy.frontend.registracie.pracovisko.index', function ($trail, $mtUdalostId) {
    /** @var Udalost $udalost */
    $udalost = Udalost::query()->findOrFail($mtUdalostId);
    $trail->parent('modul.terminy.frontend.udalosti.udalost.show', $mtUdalostId);
    $trail->push('Registrácie', route('modul.terminy.frontend.registracie.pracovisko.index', $udalost));
});
