<?php

namespace common\logic\User\UserUserGroup\Service;

use common\logic\AbstractBuilder;
use common\logic\User\User\Model\User;
use common\logic\User\UserGroup\Model\UserGroup;
use common\logic\User\UserUserGroup\Model\UserUserGroup;

class UserUserGroupBuilder extends AbstractBuilder
{
    public function instanciateUserUserGroup(User $user, UserGroup $userGroup): UserUserGroup
    {
        $userUserGroup = new UserUserGroup();
        $userUserGroup->populateUser($user);
        $userUserGroup->populateUserGroup($userGroup);

        return $userUserGroup;
    }

    public function createUserUserGroup(User $user, UserGroup $userGroup): UserUserGroup
    {
        $userUserGroup = $this->instanciateUserUserGroup($user, $userGroup);
        $this->create($userUserGroup);

        return $userUserGroup;
    }
}