<?php

namespace domain\User\UserUserGroup;

use domain\User\User\User;
use domain\User\UserGroup\UserGroup;
use domain\_\AbstractBuilder;

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;
    }
}