<?php

namespace App\Models;

use App\Models\BaseModel;

class ParentMeetingSchedule extends BaseModel
{
    protected $table = 'parent_meeting_schedules';

    // ✅ CI: useTimestamps = true (created_at/updated_at)
    public $timestamps = true;

    protected $fillable = [
        'student_id',
        'parent_user_id',
        'parent_name',
        'student_name',
        'class_section_name',
        'date',
        'time',
        'notes',
        'semester',
        'school_year',
        'status',
        'created_by',
        'created_at',
        'updated_at',
    ];

    protected $casts = [
        'student_id'     => 'integer',
        'parent_user_id' => 'integer',
        'created_by'     => 'integer',

        // if these are DATE/TIME columns:
        'date'           => 'date',
        // time is typically stored as TIME or string; keep as string unless DATETIME
        'time'           => 'string',
    ];

    /* Optional relationships */
    public function student()
    {
        return $this->belongsTo(Student::class, 'student_id');
    }

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

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