<?php

namespace App\Models\Hodnotenie;

use App\Models\Pouzivatel\Pouzivatel;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;

/**
 * Class HodnotenieModel
 *
 * @property int $id
 * @property int $hodnotil_id
 * @property Pouzivatel $hodnotil
 * @property HodnotenieEnum $hodnotenie
 * @property DateTimeInterface $created_at
 * @property DateTimeInterface $updated_at
 */
class HodnotenieModel extends Model
{
    use HasFactory;

    /**
     * @var string
     */
    protected $table = 'hodnotenia';

    /**
     * @var string[]
     */
    protected $fillable = [
        'hodnotenie',
    ];

    /**
     * @var class-string[]
     */
    protected $casts = [
        'hodnotenie' => HodnotenieEnum::class,
    ];

    public function hodnotitelne(): MorphTo
    {
        return $this->morphTo();
    }

    public function hodnotil(): BelongsTo
    {
        return $this->belongsTo(Pouzivatel::class, 'hodnotil_id');
    }
}
