<?php

namespace App\Modules\HR\Training\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class TrainingEnrollment extends Model
{
    use BelongsToTenant;

    protected $table = 'hr_training_enrollments';

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return ['hours' => 'decimal:2', 'evaluation_score' => 'decimal:2', 'cost' => 'decimal:2'];
    }

    public function session(): BelongsTo
    {
        return $this->belongsTo(TrainingSession::class, 'session_id');
    }
}
