<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class StudyLog extends Model
{
    protected $fillable = [
        'user_id',
        'course_id',
        'study_group_id',
        'study_date',
        'minutes',
        'type',
        'title',
        'notes',
    ];

    protected $casts = [
        'study_date' => 'date',
        'minutes' => 'integer',
    ];

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

    public function course()
    {
        return $this->belongsTo(Course::class);
    }

    public function group()
    {
        return $this->belongsTo(StudyGroup::class, 'study_group_id');
    }
}