<?php

namespace App\Models;

use CodeIgniter\Model;

class PolicyTransactionModel extends Model
{
    protected $table            = 'policy_transaction';
    protected $primaryKey       = 'id';

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

    protected $allowedFields    = [
        'issuer',
        'client_id',
        'client_branch_id',
        'vehicle_id',
        'insurer_id',
        'insurer_branch_id',
        'tpa_id',
        'tpa_branch_id',
        'policy_type_id',
        'client_policy_id',
        'issue_type',
        'source_client_policy_id',
        'policy_no',
        'cd_ac_no',
        'cd_ac_pk',
        'policy_issue_date',
        'policy_start_date',
        'policy_end_date',
        'action_type',
        'endorsement_no',
        'data_received_date',
        'closure_date',
        'emp_count',
        'dependent_count',
        'revenue_type',
        'co_share',
        'pre_payable_by',
        'bro_payable_by',
        'tsi',
        'status',
        'ct_status',
        'created_by',
        'updated_by',
        'created_at',
        'updated_at',
        'is_active',
        'co_broking_status',
        'installment',
        'installment_data',
        'location',
        'links',
        'stage',
        'etat',
        'etat_band',
        'edate',
        'renewal_date',
        'rollover_date',
        'policy_holder_name',
        'same_as_proposer',
        'ref',
        'spl',
        'fund_received',
        'listed_insurers',
        'ppteam',
        'endorse_eff_date',
        'month',
        'sales_generated_by',
        'serviced_by',
        'ct_type',
        'ct_tran_id',
        'remarks',
        'install_due_date',
        'policy_with_corr',
        'is_cd_reduce_from_bds',
        'agent_id',
        'agent_code'
    ];

    // Auto timestamp handling
    protected $useTimestamps = true;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';

    // Validation rules (optional)
    protected $validationRules    = [];
    protected $validationMessages = [];
    protected $skipValidation     = true;
}
