<?php

namespace App\Models;

use CodeIgniter\Model;

class OrganizationModel extends Model
{
    protected $table            = 'm_organization';
    protected $primaryKey       = 'org_id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $useSoftDeletes   = false;

    protected $allowedFields    = [
        'name',
        'logo',
        'sender_email',
        'mail_user_name',
        'mail_password',
        'mail_host',
        'mail_port',
        'layout_color',
        'secondary_color',
        'ternary_color',
        'color',
        'services_ids',
        'created_on',
        'created_by',
        'updated_on',
        'updated_by',
        'is_active'
    ];

    // Enable timestamps
    protected $useTimestamps = false; // Set true if you want CI4 to manage created_at/updated_at fields
    protected $createdField  = 'created_on';
    protected $updatedField  = 'updated_on';

    // Validation rules (optional)
    protected $validationRules = [
        'name'          => 'required|max_length[100]',
        'sender_email'  => 'valid_email',
        'mail_port'     => 'integer',
        'layout_color'  => 'max_length[10]',
        'color'         => 'max_length[10]',
        'is_active'     => 'in_list[0,1]',
    ];

    protected $validationMessages = [];
    protected $skipValidation     = true;
}
