<?php
namespace App\Models;

use CodeIgniter\Model;

class TaskDistributionModel extends Model
{
    protected $table = 'task_distribution';
    protected $primaryKey = 'id';
    protected $allowedFields = ['employee_id', 'barcode_id', 'assigned_at'];

    public function assignTask($employeeId, $barcodeId)
    {
        return $this->insert([
            'employee_id' => $employeeId,
            'barcode_id' => $barcodeId
        ]);
    }

    public function getTasksByEmployee($employeeId)
    {
        return $this->where('employee_id', $employeeId)->findAll();
    }
}
