<?php

namespace App\Models;

use CodeIgniter\Model;

class TaxiModel extends Model
{
    protected $table      = 'c_taxi';
    protected $primaryKey = 'taxi_id';

    protected $allowedFields = [
        'plan_id',
        'destination_city',
        'date',
        'time',
        'location_of_pickup',
        'car_required_for',
        'no_of_passengers',
        'car_type',
        'comments',
        'created_by',
        'updated_by',
        'is_active'
    ];

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

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

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