<?php

namespace App\Models;

use CodeIgniter\Model;

class VisaModel extends Model
{
    protected $table      = 'c_visa';
    protected $primaryKey = 'visa_id';

    protected $allowedFields = [
        'plan_id',
        'country_code',
        'type_of_visa',
        'start_date',
        'comments',
        'created_by',
        'updated_by',
        'is_active'
    ];

    protected $useTimestamps = false;
    protected $createdField  = 'created_on';
    protected $updatedField  = 'updated_on';

    /**
     * Get active visa records
     */
    public function getActiveVisas()
    {
        return $this->where('is_active', 1)->findAll();
    }

    /**
     * Get visa records for a specific plan
     */
    public function getVisasByPlan($planId)
    {
        return $this->where('plan_id', $planId)->findAll();
    }
}
