using Modules.User.Domain.Entities.User;
using Modules.User.Domain.ValueObjects;

namespace Modules.User.Domain.Factories;

public static class UserFactory
{
    public static Entities.User.User Load(Guid id, string nickName, string? firstName, string? patronymic, string? lastName,
        Guid? avatarId, Guid? languageId, DateOnly? birthDate, Account account)
    {
        var user = new Entities.User.User(id, nickName, account);
        user.SetName(firstName, patronymic, lastName);
        if (avatarId.HasValue) user.SetAvatar(Avatar.Create(avatarId.Value));
        if (languageId.HasValue) user.SetLanguage(Language.Create(languageId.Value));
        user.SetBirthDate(birthDate);
        return user;
    }
}