<?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->query = $this->loadService(UserUserGroupRepositoryQuery::class);
    }

    public function getDefaultOptionsSearch(): array
    {
        return [
            'with' => [],
            'join_with' => [],
            'orderby' => '',
            'attribute_id_producer' => ''
        ] ;
    }

    public function findUserUserGroupsByUser(User $user)
    {
        return UserUserGroup::searchAll([
            'id_user' => $user->id
        ]);
    }
}