using Collaboration.Domain.Entities; using Collaboration.Domain.Enums; namespace Collaboration.Application.DTOs.Responses; public record SessionResponse( Guid SessionId, string SessionCode, string Title, SessionType SessionType, SessionStatus Status, SessionMode Mode, string? ContextModuleCode, string? ContextRecordId, string? ContextRecordLabel, string? ContextRouteUrl, DateTime? ScheduledAt, int? ScheduledDurationMinutes, DateTime? StartedAt, DateTime? EndedAt, DateTime CreatedAt, Guid CreatedBy, int MaxParticipants, List Participants ) { public static SessionResponse From(CollabSession s) => new( s.SessionId, s.SessionCode, s.Title, s.SessionType, s.Status, s.Mode, s.ContextModuleCode, s.ContextRecordId, s.ContextRecordLabel, s.ContextRouteUrl, s.ScheduledAt, s.ScheduledDurationMinutes, s.StartedAt, s.EndedAt, s.CreatedAt, s.CreatedBy, s.MaxParticipants, s.Participants.Select(ParticipantResponse.From).ToList() ); } public record SessionSummaryResponse( Guid SessionId, string SessionCode, string Title, SessionStatus Status, SessionMode Mode, string? ContextModuleCode, string? ContextRecordLabel, DateTime? ScheduledAt, DateTime? StartedAt, int ActiveParticipantCount ) { public static SessionSummaryResponse From(CollabSession s) => new( s.SessionId, s.SessionCode, s.Title, s.Status, s.Mode, s.ContextModuleCode, s.ContextRecordLabel, s.ScheduledAt, s.StartedAt, s.Participants.Count(p => p.IsActive) ); } public record ParticipantResponse( Guid ParticipantId, Guid UserId, string DisplayName, ParticipantRole Role, bool IsActive, bool HasControl, bool IsFollowingHost, string CursorColor, DateTime JoinedAt, DateTime? LeftAt ) { public static ParticipantResponse From(CollabParticipant p) => new( p.ParticipantId, p.UserId, p.DisplayName, p.Role, p.IsActive, p.HasControl, p.IsFollowingHost, p.CursorColor, p.JoinedAt, p.LeftAt ); } public record InviteResponse( Guid InviteId, Guid SessionId, string SessionTitle, string InviteToken, string JoinUrl, // Constructed by service ParticipantRole OfferedRole, InviteStatus Status, DateTime ExpiresAt, DateTime CreatedAt ); public record JoinSessionResponse( Guid SessionId, string SessionCode, string Title, SessionMode Mode, string? ContextRouteUrl, ParticipantRole YourRole, bool YouHaveControl, string YourCursorColor, List Participants, CollabConfigClientResponse Config // Relevant org settings for the client ); /// Subset of org config that Angular client needs to know about. public record CollabConfigClientResponse( bool AllowScreenShare, bool EnableCoBrowse, bool EnableInSessionChat, bool EnableAnnotations, bool EnableCursorBroadcast, bool EnableFormSync, ControlConsentMode ControlConsentMode ) { public static CollabConfigClientResponse From(CollabConfig c) => new( c.AllowScreenShare, c.EnableCoBrowse, c.EnableInSessionChat, c.EnableAnnotations, c.EnableCursorBroadcast, c.EnableFormSync, c.ControlConsentMode ); } public record CollabConfigResponse( Guid OrgId, int MaxParticipantsDefault, int MaxParticipantsAbsolute, int SessionTimeoutMinutes, int InviteLinkExpiryMinutes, int MaxScheduledSessionsPerUser, bool AllowScreenShare, bool AllowAnonymousJoin, bool AllowGuestJoinViaLink, bool EnableAuditLog, bool EnableCoBrowse, bool EnableInSessionChat, bool EnableAnnotations, bool EnableCursorBroadcast, bool EnableFormSync, ControlConsentMode ControlConsentMode, string? AllowedModulesJson ) { public static CollabConfigResponse From(CollabConfig c) => new( c.OrgId, c.MaxParticipantsDefault, c.MaxParticipantsAbsolute, c.SessionTimeoutMinutes, c.InviteLinkExpiryMinutes, c.MaxScheduledSessionsPerUser, c.AllowScreenShare, c.AllowAnonymousJoin, c.AllowGuestJoinViaLink, c.EnableAuditLog, c.EnableCoBrowse, c.EnableInSessionChat, c.EnableAnnotations, c.EnableCursorBroadcast, c.EnableFormSync, c.ControlConsentMode, c.AllowedModulesJson ); }