<?php

namespace App\Models;

use App\Models\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Model;

class Transfer extends Model
{
    use LogsActivity;
    protected $table = 'transferuri';

    protected $fillable = [
        'elev_id',
        'tip',
        'clasa_veche_id',
        'clasa_noua_id',
        'scoala_origine',
        'scoala_destinatie',
        'data_transfer',
        'numar_document',
        'observatii',
        'inregistrat_de',
    ];

    protected $casts = [
        'data_transfer' => 'date',
    ];

    public function elev()
    {
        return $this->belongsTo(Elev::class);
    }

    public function clasaVeche()
    {
        return $this->belongsTo(Clasa::class, 'clasa_veche_id');
    }

    public function clasaNoua()
    {
        return $this->belongsTo(Clasa::class, 'clasa_noua_id');
    }

    public function inregistratDe()
    {
        return $this->belongsTo(User::class, 'inregistrat_de');
    }
}
