using Modules.User.Domain.Entities.Access;

namespace Modules.User.Domain.Factories.Access;

public static class RoleFactory
{
    public static Role Load(int id, string code, string name, string? description,
        DateTime creationDate, IEnumerable<Permission> permissions)
    {
        var role = new Role(id, code, name, creationDate, permissions);
        if (!string.IsNullOrWhiteSpace(description)) role.SetDescription(description);
        return role;
    }
}