namespace OTSSignsOrchestrator.Core.Services; /// /// Orchestrates the complete Authentik invitation infrastructure setup for a customer. /// Creates a group, enrollment flow with stages, role with invitation permissions, /// and scoping policies so the customer admin can invite new users without OTS involvement. /// public interface IInvitationSetupService { /// /// Sets up the full invitation infrastructure for a customer in Authentik: /// /// Create customer group (e.g. customer-acme). /// Create invitation stage (invite-only, no anonymous enrollment). /// Create enrollment flow with stages: Invitation → Prompt → UserWrite → UserLogin. /// Bind expression policy to UserWrite stage to auto-assign users to the customer group. /// Create invite-manager role with invitation CRUD permissions. /// Assign role to customer group and bind scoping policy to flow. /// /// All operations are idempotent — safe to call multiple times for the same customer. /// /// Short customer identifier (e.g. "acme"). /// Human-readable customer name (e.g. "Acme Corp"). /// Cancellation token. /// Result describing what was created and the enrollment flow URL. Task SetupCustomerInvitationAsync( string customerAbbrev, string customerName, CancellationToken ct = default); } /// /// Result of the invitation infrastructure setup. /// public class InvitationSetupResult { /// Whether the setup completed successfully. public bool Success { get; set; } /// Human-readable status message. public string Message { get; set; } = string.Empty; /// Name of the customer group created in Authentik. public string GroupName { get; set; } = string.Empty; /// Slug of the enrollment flow (used in invite links). public string EnrollmentFlowSlug { get; set; } = string.Empty; /// Name of the role created for invitation management. public string RoleName { get; set; } = string.Empty; /// /// Full URL to the Authentik user portal where the customer admin /// can manage invitations. /// public string? InvitationManagementUrl { get; set; } }