<?php


namespace App\Components\DataGrids;


use App\Model\Facades\GameFacade;
use App\Model\Translator;
use Kdyby\Doctrine\QueryBuilder;
use Ublaboo\DataGrid\DataGrid;

class BossesDataGrid extends BaseMmoGameDataGrid
{
    public function __construct(Translator $translator, GameFacade $gameFacade)
    {
        parent::__construct($translator, $gameFacade);
    }


    protected function setupDataSource() : QueryBuilder
    {
        return $this->gameFacade->getInstanceReader()->getBossesGridDataSource($this->game);
    }

    protected function setupColumns(DataGrid $grid)
    {
        $this->columnNamePreset($grid);
        $grid->addColumnText('instance', 'Instance', 'instance.name')
            ->setSortable('i.name')
            ->sortableResetPagination();
        $grid->addColumnText('type', 'Type', 'instance.instanceType.name')
            ->setSortable('t.name')
            ->sortableResetPagination();
    }

}