<?php

namespace common\logic\User\UserUserGroup\Repository;

use common\logic\AbstractRepository;
use common\logic\User\User\Model\User;
use common\logic\User\UserUserGroup\Model\UserUserGroup;

class UserUserGroupRepository extends AbstractRepository
{
    protected UserUserGroupRepositoryQuery $query;

    public function loadDependencies(): void
    {
        $this->loadQuery(UserUserGroupRepositoryQuery::class);
    }

    public function getDefaultOptionsSearch(): array
    {
        return [
            self::WITH => [],
            self::JOIN_WITH => [],
            self::ORDER_BY => '',
            self::ATTRIBUTE_ID_PRODUCER => ''
        ];
    }

    public function findUserUserGroupsByUser(User $user)
    {
        return $this->createDefaultQuery()
            ->filterByUser($user)
            ->find();
    }
}