public function summaryTable(callable $summaryTableDefinitionCallback)
    {
        $definition = new SummaryTableDefinition($this, $this->class, $this->dataSource);

        $idField = Field::name(IReadModule::SUMMARY_TABLE_ID_COLUMN)->label('Id')
            ->int()
            ->required();

        if ($this->dataSource instanceof IRepository) {
            $definition->mapProperty(IEntity::ID)
                ->hidden()
                ->to($idField);
        } else {
            $definition
                ->mapCallback(function (ITypedObject $object) {
                    return $this->dataSource->getObjectId($object);
                })
                ->hidden()
                ->to($idField);
        }

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.define-summary-table', $definition
        );

        $summaryTableDefinitionCallback($definition);

        $this->eventDispatcher->emit(
            $this->packageName . '.' . $this->name . '.defined-summary-table', $definition
        );

        $this->tables[IReadModule::SUMMARY_TABLE] = $this->summaryTable = $definition->finalize();
    }