<?php

use App\Models\Informacia\Informacia;
use App\Models\Pouzivatel\Pouzivatel;
use Diglactic\Breadcrumbs\Breadcrumbs;

Breadcrumbs::for('portal.sprava.index', function ($trail) {
    $trail->parent('portal.plocha');
    $trail->push('Správa', route('portal.sprava.index'));
});

Breadcrumbs::for('portal.sprava.pouzivatelia.index', function ($trail) {
    $trail->parent('portal.sprava.index');
    $trail->push('Používatelia', route('portal.sprava.pouzivatelia.index'));
});

Breadcrumbs::for('portal.sprava.pouzivatelia.edit', function ($trail, $pouzivatelId) {
    $pouzivatel = Pouzivatel::query()->findOrFail($pouzivatelId);

    $trail->parent('portal.sprava.pouzivatelia.index');
    $trail->push($pouzivatel->cele_meno, route('portal.sprava.pouzivatelia.edit', $pouzivatel));
});

Breadcrumbs::for('portal.sprava.pouzivatelia.akcie.index', function ($trail, $pouzivatelId) {
    $pouzivatel = Pouzivatel::query()->findOrFail($pouzivatelId);

    $trail->parent('portal.sprava.pouzivatelia.index');
    $trail->push($pouzivatel->cele_meno, route('portal.sprava.pouzivatelia.edit', $pouzivatel));
});

Breadcrumbs::for('portal.sprava.pouzivatelia.spravy.index', function ($trail) {
    $trail->parent('portal.sprava.index');
    $trail->push('Správy', route('portal.sprava.pouzivatelia.spravy.index'));
});

Breadcrumbs::for('portal.sprava.informacie.index', function ($trail) {
    $trail->parent('portal.sprava.index');
    $trail->push('Informácie', route('portal.sprava.informacie.index'));
});

Breadcrumbs::for('portal.sprava.informacie.create', function ($trail) {
    $trail->parent('portal.sprava.informacie.index');
    $trail->push('Informácia', route('portal.sprava.informacie.create'));
});

Breadcrumbs::for('portal.sprava.informacie.edit', function ($trail, $informaciaId) {
    // moznost upravit musi mat aj zneplatnena (trashed) informacia
    $informacia = Informacia::withTrashed()->findOrFail($informaciaId);

    $trail->parent('portal.sprava.informacie.index');
    $trail->push('Informácia', route('portal.sprava.informacie.edit', $informacia));
});

Breadcrumbs::for('portal.sprava.informacie.hodnotenia.index', function ($trail, $informaciaId) {
    // moznost upravit musi mat aj zneplatnena (trashed) informacia
    $informacia = Informacia::withTrashed()->findOrFail($informaciaId);

    $trail->parent('portal.sprava.informacie.edit', $informaciaId);
    $trail->push('Hodnotenia', route('portal.sprava.informacie.hodnotenia.index', $informacia));
});

Breadcrumbs::for('portal.sprava.moduly.index', function ($trail) {
    $trail->parent('portal.sprava.index');
    $trail->push('Moduly', route('portal.sprava.moduly.index'));
});
