<?php

namespace App\Models;

use App\Models\BaseModel;

class Preferences extends BaseModel
{
    protected $table = 'user_preferences';

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

    protected $fillable = [
        'user_id',
        'notification_email',
        'notification_sms',
        'theme',
        'language',
        'style_color',
        'menu_color',
        'menu_custom_bg',
        'menu_custom_text',
        'menu_custom_mode',
        'created_at',
        'updated_at',
    ];

    protected $casts = [
        'user_id'                     => 'integer',

        'receive_email_notifications' => 'boolean',
        'receive_sms_notifications'   => 'boolean',
        'receive_push_notifications'  => 'boolean',
        'daily_summary_email'         => 'boolean',
        'privacy_mode'                => 'boolean',
        'marketing_emails'            => 'boolean',
        'account_activity_alerts'     => 'boolean',
    ];

    /* Optional relationship */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
