/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of OmiLAXR.xAPI. */ #if XAPI_REGISTRY_EXISTS using System.Collections.Generic; using System.Linq; using xAPI.Registry; namespace OmiLAXR.xAPI.Extensions { /// /// Extension methods for converting OmiLAXR actor types to xAPI Registry actor representations. /// Provides seamless integration between the OmiLAXR analytics framework and the xAPI Registry /// by handling the transformation of various actor types (learners, instructors, teams) into /// standardized xAPI_Actor instances for consistent statement generation. /// public static class xApiRegistry_Ext { /// /// Converts a generic Actor instance to an xAPI Registry compatible xAPI_Actor. /// Maps the actor's name and email properties to the standardized xAPI actor format /// used throughout the xAPI Registry system for consistent actor identification. /// /// The Actor instance to convert /// xAPI_Actor instance with mapped name and email properties public static xAPI_Actor ToXAPIActor(this Actor actor) => new xAPI_Actor(actor.actorName, actor.actorEmail); /// /// Converts a collection of Actor instances to xAPI Registry compatible xAPI_Actor instances. /// Enables batch conversion of multiple actors for scenarios involving groups, /// teams, or multiple learners in collaborative learning environments. /// /// Collection of Actor instances to convert /// IEnumerable of xAPI_Actor instances with converted actor data public static IEnumerable ToXAPIActors(this IEnumerable actors) => actors.Select(a => a.ToXAPIActor()); /// /// Converts an Instructor instance to an xAPI Registry compatible xAPI_Actor. /// Handles the specific case of instructor actors by mapping instructor-specific /// properties to the standardized xAPI actor format for educational context tracking. /// /// The Instructor instance to convert /// xAPI_Actor instance representing the instructor in xAPI format public static xAPI_Actor ToXAPIActor(this Instructor actor) => new xAPI_Actor(actor.instructorName, actor.instructorEmail); /// /// Converts a Team instance to an xAPI Registry compatible xAPI_Actor. /// Enables team-based analytics by treating teams as collective actors /// within the xAPI framework for collaborative learning scenario tracking. /// /// The Team instance to convert /// xAPI_Actor instance representing the team as a collective actor public static xAPI_Actor ToXAPIActor(this Team team) => new xAPI_Actor(team.teamName, team.teamEmail); } } #endif