<?php

namespace App\Models;

use CodeIgniter\Model;

class PreferencesModel extends Model
{
    protected $table = 'user_preferences'; // Adjusted to match the table name
    protected $primaryKey = 'id';          // Primary key of the table

    // Allowed fields to enable mass assignment
    protected $allowedFields = [
        'user_id',                      // Foreign key linking preferences to a user
        'notification_email',           // Email notifications preference
        'notification_sms',             // SMS notifications preference
        'theme',                        // Theme preference (e.g., light or dark)
        'language',                     // Language preference
        'timezone',                     // Timezone preference
        'style_color',                  // UI accent color key
        'menu_color',                   // Menu palette key or 'custom'
        'menu_custom_bg',               // Custom menu background color
        'menu_custom_text',             // Custom menu text color
        'menu_custom_mode',             // Custom menu mode: light|dark
        'created_at',                   // Timestamp of when the record was created
        'updated_at'                    // Timestamp of when the record was last updated
    ];

    // Enable automatic timestamp management if needed
    protected $useTimestamps = true;
    protected $createdField = 'created_at';
    protected $updatedField = 'updated_at';
}
