<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Attributes\Guarded;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

#[Guarded(['id'])]
class Lecturer extends Model
{
    use HasFactory, SoftDeletes;

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    public function departments(): BelongsToMany
    {
        return $this->belongsToMany(Department::class, 'lecturer_department');
    }

    public function advisees(): HasMany
    {
        return $this->hasMany(Student::class, 'academic_advisor_id');
    }

    public function leaderships(): HasMany
    {
        return $this->hasMany(DepartmentLeadership::class);
    }

    public function academicAdvisingLogs(): HasMany
    {
        return $this->hasMany(AcademicAdvisingLog::class);
    }
}
