<?php

namespace Lc\SovBundle\Controller\User;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\User\GroupUserContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class GroupUserAdminController extends AbstractAdminController
{
    public function getRepositoryQuery(): RepositoryQueryInterface
    {
        return $this->get(GroupUserContainer::class)->getRepositoryQuery();
    }

    public function configureFields(string $pageName): iterable
    {
        return [
            TextField::new('title')->setSortable(true),
            TextField::new('devAlias')->hideOnIndex(),
            StatusField::new('status')->setSortable(true),
        ];
    }

    public function createEntity(string $entityFqcn)
    {
        return $this->getGroupUserContainer()->getFactory()->create();
    }
}
