<?php

namespace App\Models;

use CodeIgniter\Model;

class ClassModel extends Model
{
    protected $table = 'classes'; // The table name
    protected $primaryKey = 'id'; // The correct primary key for the classes table

    protected $allowedFields = [
        'class_name', 
        'schedule', 
        'capacity'
    ]; // Fields that are allowed to be manipulated

    protected $useTimestamps = false; 

    public function getAllClasses()
    {
        return $this->findAll();
    }

    public function getClassById($id)
    {
        return $this->find($id);
    }

    public function createClass($data)
    {
        return $this->insert($data);
    }

    public function updateClass($id, $data)
    {
        return $this->update($id, $data);
    }

    public function deleteClass($id)
    {
        return $this->delete($id);
    }
}
?>
