using Microsoft.Graph; namespace Teamified.Api.Teams.Models; public sealed class Team { public string Id { get; set; } public string DisplayName { get; set; } public string Description { get; set; } public IEnumerable Owners { get; set; } public IEnumerable Members { get; set; } public IEnumerable Channels { get; set; } public Team() { Id = "unknown"; DisplayName = "unknown"; Description = "unknown"; Owners = new List(); Members = new List(); Channels = new List(); } public static Team MapFromGraphGroup(Group graphGroup) { return new Team { Id = graphGroup.Id, Description = graphGroup.Description, DisplayName = graphGroup.DisplayName, Members = graphGroup.Members != null ? graphGroup.Members.Select(m => IdentityPrincipal.MapFromDirectoryObject(m)) : new List(), Owners = graphGroup.Owners != null ? graphGroup.Owners.Select(o => IdentityPrincipal.MapFromDirectoryObject(o)) : new List() }; } internal void AddOwners(IList owners) { Owners = owners.Select(o => IdentityPrincipal.MapFromDirectoryObject(o)); } internal void AddChannels(IList channels) { Channels = channels.Select(c => Channel.MapFromGraphChannel(c)); } }