<?php

declare(strict_types=1);

namespace External\ZNZBundle\Admin\lists;

use Query\QueryBuilder;

class PricelistList extends \KupShop\PricelistBundle\Admin\lists\PricelistList
{
    public function customizeTableDef($tableDef)
    {
        $tableDef = parent::customizeTableDef($tableDef);

        $tableDef['fields']['ZNZ Výchozí'] = [
            'field' => 'znz_is_default',
            'render' => 'renderBoolean',
            'spec' => function (QueryBuilder $qb) {
                $qb->addSelect('zpl.is_default as znz_is_default')
                    ->leftJoin('pl', 'znz_pricelists', 'zpl', 'zpl.id_pricelist = pl.id');
            },
        ];

        return $tableDef;
    }
}

return PricelistList::class;
