<?php

namespace App\FiveM\Models\QBCore;

use Illuminate\Database\Eloquent\Model;

/**
 * Maps to QBCore's/Qbox's `players` table. Column shapes per the
 * qb-core/qbx_core convention: money/charinfo/job/gang/position/metadata
 * are all JSON columns.
 */
class Player extends Model
{
    protected $connection = 'fivem';

    protected $primaryKey = 'citizenid';

    public $incrementing = false;

    protected $keyType = 'string';

    public $timestamps = false;

    protected function casts(): array
    {
        return [
            'money' => 'array',
            'charinfo' => 'array',
            'job' => 'array',
            'gang' => 'array',
            'position' => 'array',
            'metadata' => 'array',
        ];
    }

    public function getTable()
    {
        return config('fivem.tables.'.config('fivem.framework').'.players', 'players');
    }
}
