<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Timetable extends Model
{
    protected $fillable = ['stream_id', 'subject_id', 'teacher_id', 'term_id', 'day_of_week', 'start_time', 'end_time', 'room'];

    public function stream() { return $this->belongsTo(Stream::class); }
    public function subject() { return $this->belongsTo(Subject::class); }
    public function teacher() { return $this->belongsTo(Teacher::class); }
    public function term() { return $this->belongsTo(Term::class); }

    public function getDayNameAttribute(): string
    {
        return ['', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'][$this->day_of_week] ?? '';
    }
}
