import { CIAContentService } from "../services/ciaContentService"; /** * Return type for useCIAContentService hook * * Provides access to the CIA content service along with loading * and error states for proper UI handling. * * @example * ```tsx * const { ciaContentService, isLoading, error, refresh } = useCIAContentService(); * * if (isLoading) return ; * if (error) return ; * if (!ciaContentService) return null; * * // Use the service * const details = ciaContentService.getCIADetails('availability', 'High'); * ``` */ export interface UseCIAContentServiceReturn { /** * CIA content service instance * * Null while loading or if initialization failed. Check isLoading * and error states before using. */ ciaContentService: CIAContentService | null; /** * Loading state indicator * * True during initial service initialization or when refresh() is called. * Use to show loading UI. */ isLoading: boolean; /** * Error object if initialization failed * * Null if no error occurred. When present, ciaContentService will be null. * Use to show error UI and provide retry option. */ error: Error | null; /** * Function to retry service initialization * * Call this to re-attempt service creation after an error, * or to refresh the service instance. * * @example * ```tsx * {error && ( * * )} * ``` */ refresh: () => void; } /** * Custom hook to access the CIA content service with loading and error states * * Provides a convenient way to access the CIAContentService in React components * with automatic initialization, loading states, and error handling. The service * is initialized once when the component mounts and can be refreshed on demand. * * ## Features * - Automatic service initialization on mount * - Loading state management * - Error handling with retry capability * - Async initialization support * - Type-safe return values * * ## Usage Guidelines * - Always check `isLoading` before rendering content * - Handle `error` state to provide user feedback * - Verify `ciaContentService` is not null before use * - Use `refresh()` to retry after errors * * @returns Object containing the CIA content service, loading state, error state, and refresh function * * @example * ```tsx * // Basic usage with loading and error handling * function MyComponent() { * const { ciaContentService, isLoading, error, refresh } = useCIAContentService(); * * if (isLoading) { * return
Loading CIA content service...
; * } * * if (error) { * return ( *
*

Error: {error.message}

* *
* ); * } * * if (!ciaContentService) { * return
Service not available
; * } * * // Safe to use the service here * const availabilityDetails = ciaContentService.getCIADetails('availability', 'High'); * * return
{availabilityDetails.description}
; * } * ``` * * @example * ```tsx * // Advanced usage with multiple service calls * function SecurityDashboard() { * const { ciaContentService, isLoading, error } = useCIAContentService(); * const [selectedLevel, setSelectedLevel] = useState('Moderate'); * * if (isLoading || !ciaContentService) { * return ; * } * * if (error) { * return ; * } * * const availDetails = ciaContentService.getCIADetails('availability', selectedLevel); * const integrityDetails = ciaContentService.getCIADetails('integrity', selectedLevel); * const confDetails = ciaContentService.getCIADetails('confidentiality', selectedLevel); * * return ( *
*

Security Level: {selectedLevel}

* * * *
* ); * } * ``` */ export declare const useCIAContentService: () => UseCIAContentServiceReturn; //# sourceMappingURL=useCIAContentService.d.ts.map