<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class Docente extends Model
{
    protected $guarded = [];

    public $timestamps = false;

    // Relación con User
    public function docentes(): BelongsToMany
    {
        return $this->belongsToMany(User::class);
    }

    // Relación con Grupo
    public function grupos(): BelongsToMany
    {
        return $this->belongsToMany(Grupo::class, 'docente_grupo')
                    ->withPivot('materia_id');
    }

    // Relación con Material
    public function materias(): BelongsToMany
    {
        return $this->belongsToMany(Material::class, 'docente_grupo', 'docente_id', 'materia_id')
                    ->withPivot('grupo_id');
    }
}
