public function serialize(Directory $directory): array
    {
        return [
            'id' => $directory->getId(),
            'uploadDestination' => $directory->isUploadDestination(),
            'display' => [
                'showSummary' => $directory->getShowSummary(),
                'openSummary' => $directory->getOpenSummary(),
            ],

            // resource list config
            // todo : big c/c from Claroline\CoreBundle\API\Serializer\Widget\Type\ListWidgetSerializer
            'list' => [
                'actions' => $directory->hasActions(),
                'count' => $directory->hasCount(),
                // display feature
                'display' => $directory->getDisplay(),
                'availableDisplays' => $directory->getAvailableDisplays(),

                // sort feature
                'sorting' => $directory->getSortBy(),
                'availableSort' => $directory->getAvailableSort(),

                // filter feature
                'searchMode' => $directory->getSearchMode(),
                'filters' => $directory->getFilters(),
                'availableFilters' => $directory->getAvailableFilters(),

                // pagination feature
                'paginated' => $directory->isPaginated(),
                'pageSize' => $directory->getPageSize(),
                'availablePageSizes' => $directory->getAvailablePageSizes(),

                // table config
                'columns' => $directory->getDisplayedColumns(),
                'availableColumns' => $directory->getAvailableColumns(),

                // grid config
                'card' => [
                    'display' => $directory->getCard(),
                    'mapping' => [], // TODO
                ],
            ],
        ];
    }