<?php

namespace App\Models;

use CodeIgniter\Model;

class UserModel extends Model
{
    protected $table            = 'users';
    protected $primaryKey       = 'id_user';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    
    protected $allowedFields    = [
        'username', 
        'password', 
        'nama_lengkap', 
        'email', 
        'id_role', 
        'is_active'
    ];

    // Menonaktifkan timestamps agar tidak error jika kolom tidak ada di DB
    protected $useTimestamps = false;
    protected $createdField  = '';
    protected $updatedField  = '';

    // Validasi dilakukan di Controller untuk fleksibilitas (seperti update yang butuh pengecualian ID)
    protected $validationRules = [];
    protected $skipValidation  = true;
}