<?php

namespace App\Models;

use App\Models\BaseModel;

class InvoiceStudentList extends BaseModel
{
    protected $table = 'invoice_students_list';

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

    protected $fillable = [
        'invoice_id',
        'student_id',
        'student_firstname',
        'student_lastname',
        'school_id',
        'enrolled',
        'school_year',
        'created_at',
        'updated_at',
        'semester',
    ];

    protected $casts = [
        'invoice_id' => 'integer',
        'student_id' => 'integer',
        'school_id'  => 'integer',
        'enrolled'   => 'boolean',
    ];

    /* Optional relationships */
    public function invoice()
    {
        return $this->belongsTo(Invoice::class, 'invoice_id');
    }

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