import { UsageTracking } from "../components/atoms/SubscriptionGuard/PlanLimits.types"; type UsageKey = "events" | "members" | "activities" | "inventoryItems" | "bankAccounts" | "incomingTransactions" | "outcomeTransactions" | "ritualBaths"; /** * Props for useUsageQuota hook */ export interface UseUsageQuotaProps { /** * Current plan ID (free, basic, standard, advanced, unlimit) */ planId: string; /** * Current usage tracking data with detailed stats */ usage: UsageTracking; } /** * Result of checking quota for a feature */ export interface QuotaCheckResult { /** Whether the feature is enabled for this plan */ enabled: boolean; /** Whether the user can add more of this feature */ allowed: boolean; /** Current usage count */ current: number; /** Maximum allowed (-1 for unlimited) */ maxAllowed: number; /** Remaining count */ remaining: number; /** Usage percentage (0-100) */ usagePercentage: number | null; /** Whether usage is unlimited */ isUnlimited: boolean; /** Message to display */ message: string; } /** * Hook for accessing usage quota data and performing quota checks * * This hook provides both data access and quota checking functions * for use with the new UsageTracking structure from the backend. * * @example * const { data, fns } = useUsageQuota({ * planId: "basic", * usage: usageTrackingData, * }); * * // Check quota for events * const eventsQuota = fns.checkQuota("events"); * if (!eventsQuota.allowed) { * showUpgradePrompt(); * } */ declare const useUsageQuota: ({ planId, usage }: UseUsageQuotaProps) => { data: { planId: string; usage: { plan?: string | undefined; tier?: string | undefined; planName?: string | undefined; context?: string | undefined; upgradeRecommended?: boolean | undefined; nearingLimits?: string[] | undefined; usage?: { events?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; members?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; activities?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; inventoryItems?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; bankAccounts?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; incomingTransactions?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; outcomeTransactions?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; ritualBaths?: { current: number; limit: number; percentage: number; nearingLimit: boolean; } | undefined; } | undefined; features?: Record | undefined; }; }; fns: { checkQuota: (feature: string) => QuotaCheckResult; canAdd: (feature: string) => boolean; incrementUsage: (feature: string) => void; decrementUsage: (feature: string) => void; getUsageKey: (feature: string) => UsageKey; }; }; export default useUsageQuota;