export type OwnershipScope = | 'workspace_scoped_now' | 'user_scoped_now_target_workspace' | 'user_scoped_permanent'; export type EnforceabilityState = | 'hard_enforce_now' | 'soft_gate_now' | 'requires_backend_route' | 'requires_schema_migration' | 'future'; export type CollaborationPhase = 'v1_personal_data_with_workspace_billing' | 'v2_shared_workspace_data'; export type WorkspaceEntityKey = | 'workspaces' | 'workspace_memberships' | 'workspace_billing_accounts' | 'workspace_usage_periods' | 'workspace_usage_counters' | 'workspace_addon_purchases' | 'workspace_addon_balances' | 'search_jobs' | 'deep_research_batches' | 'businesses' | 'search_job_results' | 'users' | 'sessions'; export interface WorkspaceEntityReadiness { entity: WorkspaceEntityKey; currentOwnership: OwnershipScope; targetOwnership: OwnershipScope; notes: string; } export type WorkspaceCommercialCapability = | 'research_credits' | 'exports' | 'users_included' | 'workspace_limits' | 'shared_assets' | 'collaboration_permissions' | 'saved_searches' | 'deduplication' | 'export_history' | 'tagging_notes' | 'shared_lists' | 'scheduled_research' | 'crm_integrations' | 'api_access' | 'webhooks' | 'enrichments'; export interface WorkspaceCapabilityReadiness { capability: WorkspaceCommercialCapability; enforceability: EnforceabilityState; notes: string; } export interface CollaborationPhaseDefinition { phase: CollaborationPhase; description: string; includedBehaviors: string[]; } export const WORKSPACE_ENTITY_READINESS: WorkspaceEntityReadiness[] = [ { entity: 'workspaces', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Workspace metadata already exists and is the anchor for billing and future company-level ownership.', }, { entity: 'workspace_memberships', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Memberships exist now, but most product data is not yet shared through them.', }, { entity: 'workspace_billing_accounts', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Billing ownership is intentionally workspace-scoped and should remain that way.', }, { entity: 'workspace_usage_periods', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Usage periods are workspace-scoped and power quota resets.', }, { entity: 'workspace_usage_counters', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Usage counters already align with workspace billing and should stay workspace-owned.', }, { entity: 'workspace_addon_purchases', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Add-on purchase history is workspace-owned so extra capacity can be shared later.', }, { entity: 'workspace_addon_balances', currentOwnership: 'workspace_scoped_now', targetOwnership: 'workspace_scoped_now', notes: 'Add-on balances follow the same workspace billing model as quota usage.', }, { entity: 'search_jobs', currentOwnership: 'user_scoped_now_target_workspace', targetOwnership: 'workspace_scoped_now', notes: 'Search jobs are still keyed by user and should gain workspace ownership before true team history is promised.', }, { entity: 'deep_research_batches', currentOwnership: 'user_scoped_now_target_workspace', targetOwnership: 'workspace_scoped_now', notes: 'Deep research batches are user-owned today but need workspace ownership for shared territory workflows.', }, { entity: 'businesses', currentOwnership: 'user_scoped_now_target_workspace', targetOwnership: 'workspace_scoped_now', notes: 'Saved businesses should become workspace-owned before collaboration or shared exports are sold as real capabilities.', }, { entity: 'search_job_results', currentOwnership: 'user_scoped_now_target_workspace', targetOwnership: 'workspace_scoped_now', notes: 'Result links follow search jobs and businesses and should migrate with them.', }, { entity: 'users', currentOwnership: 'user_scoped_permanent', targetOwnership: 'user_scoped_permanent', notes: 'Profiles and identities remain user-scoped even as product data becomes workspace-owned.', }, { entity: 'sessions', currentOwnership: 'user_scoped_permanent', targetOwnership: 'user_scoped_permanent', notes: 'Sessions stay tied to user authentication, not workspace data ownership.', }, ]; export const WORKSPACE_CAPABILITY_READINESS: WorkspaceCapabilityReadiness[] = [ { capability: 'research_credits', enforceability: 'hard_enforce_now', notes: 'Workspace-scoped billing and counters already support hard enforcement for research actions.', }, { capability: 'exports', enforceability: 'requires_backend_route', notes: 'Export policy exists, but hard enforcement waits on a backend export endpoint.', }, { capability: 'users_included', enforceability: 'soft_gate_now', notes: 'Workspace membership counts exist, but product data is not yet shared enough for full seat enforcement.', }, { capability: 'workspace_limits', enforceability: 'soft_gate_now', notes: 'Commercial workspace limits can be surfaced, but multi-workspace UX and switching are still limited.', }, { capability: 'shared_assets', enforceability: 'requires_schema_migration', notes: 'Shared search history, saved businesses, and list ownership require workspace-scoped domain data first.', }, { capability: 'collaboration_permissions', enforceability: 'requires_schema_migration', notes: 'Role-aware collaboration depends on moving core entities from user ownership to workspace ownership.', }, { capability: 'saved_searches', enforceability: 'future', notes: 'Marketed feature today, but still needs product implementation and likely workspace-aware persistence.', }, { capability: 'deduplication', enforceability: 'future', notes: 'Commercially positioned but not implemented as a workspace-level workflow yet.', }, { capability: 'export_history', enforceability: 'future', notes: 'Requires backend export jobs and persistent export records.', }, { capability: 'tagging_notes', enforceability: 'requires_schema_migration', notes: 'Tags and notes should land on workspace-owned business/search entities before collaboration is enabled.', }, { capability: 'shared_lists', enforceability: 'requires_schema_migration', notes: 'Shared lists require workspace-owned saved entities and list permission rules.', }, { capability: 'scheduled_research', enforceability: 'future', notes: 'Needs async job scheduling plus ownership decisions for who can see and manage scheduled runs.', }, { capability: 'crm_integrations', enforceability: 'future', notes: 'Requires integration surfaces and likely workspace-scoped credentials/settings.', }, { capability: 'api_access', enforceability: 'future', notes: 'Entitlement policy exists, but actual API route surfaces and auth scopes are not live yet.', }, { capability: 'webhooks', enforceability: 'future', notes: 'Depends on integration/event infrastructure and workspace-level endpoint management.', }, { capability: 'enrichments', enforceability: 'future', notes: 'Entitlement model exists, but enrichment jobs and resource consumption are not active yet.', }, ]; export const COLLABORATION_PHASES: CollaborationPhaseDefinition[] = [ { phase: 'v1_personal_data_with_workspace_billing', description: 'Billing, quotas, and memberships are workspace-based, but most saved operational data still behaves as personal user-owned data.', includedBehaviors: [ 'A user consumes usage against their primary workspace.', 'Billing and quotas are tracked at the workspace level.', 'Search history and saved businesses remain effectively personal even inside a workspace shell.', ], }, { phase: 'v2_shared_workspace_data', description: 'Core research and saved-business entities become workspace-owned, enabling true shared history, shared lists, and role-aware collaboration.', includedBehaviors: [ 'Search jobs and deep research batches are workspace-owned.', 'Saved businesses and results can be shared across members.', 'Collaboration permissions and shared asset rules can be enforced meaningfully.', ], }, ]; export const CURRENT_COLLABORATION_PHASE: CollaborationPhase = 'v1_personal_data_with_workspace_billing';