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

namespace Modules.User.Domain.Factories;

public static class AccountFactory
{
    public static Account Load(Guid id, Email email, string hashedPassword, IEnumerable<Session> sessions,
        IEnumerable<RoleGrant> roles, IEnumerable<PermissionGrant> permissions, IEnumerable<Ban> bans)
    {
        var acc = new Account(id, email, hashedPassword);
        foreach (var s in sessions) acc.AddSessionRaw(s);
        foreach (var r in  roles) acc.AddRoleGrantRaw(r);
        foreach (var p in  permissions) acc.AddPermissionGrantRaw(p);
        foreach (var b in  bans) acc.AddBanRaw(b);
        return acc;
    }
}