<?php

declare(strict_types=1);

namespace Seka\Vzdelavanie\Models\Pouzivatel\Testovanie;

use Illuminate\Database\Eloquent\Model;

/**
 * Class Odpoved
 *
 * @package Seka\Vzdelavanie\Models\Pouzivatel\Testovanie
 */
class Odpoved extends Model
{
    /**
     * @var string
     */
    protected $table = 'vzdelavanie_pouzivatel_testovanie_odpovede';

    /**
     * @var string[]
     */
    protected $fillable = [
        'znenie',
        'spravna',
        'zvolena',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function otazka()
    {
        return $this->belongsTo(Otazka::class, 'pouzivatel_testovanie_otazka_id', 'id');
    }

    /**
     * @return bool
     */
    public function jeSpravna()
    {
        return (bool) $this->getAttribute('spravna');
    }

    /**
     * @return bool
     */
    public function nieJeSpravna()
    {
        return ! (bool) $this->getAttribute('spravna');
    }

    /**
     * @param string      $childType
     * @param mixed       $value
     * @param string|null $field
     *
     * @return \Illuminate\Database\Eloquent\Model|void|null
     */
    public function resolveChildRouteBinding($childType, $value, $field)
    {
        // TODO: Implement resolveChildRouteBinding() method.
    }
}
