<?php

namespace App\Models;

use CodeIgniter\Model;

class InvoiceModel extends Model
{
    protected $table            = 'partner_invoice';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;

    protected $returnType       = 'array';
    protected $useSoftDeletes   = false;

    protected $allowedFields    = [
        'invoice_no',
        'invoice_amount',
        'broker_id',
        'agent_id',
        'till_date',
        'invoice_date',
        'payout_status',
        'is_active',
        'created_at',
        'created_by',
        'updated_at',
        'updated_by',
        'pos_id',
    ];

    // Timestamps
    protected $useTimestamps = false;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';

    // Validation (optional)
    protected $validationRules = [
        'invoice_no'      => 'required',
        'invoice_amount'  => 'decimal',
        'invoice_date'    => 'required|valid_date',
    ];

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