/** * UUID Utility Module * * Provides UUID generation and parsing utilities for device identification, * job tracking, and unique identifier generation. * * @example * ```typescript * import { generateUUID, isValidUUID } from '@/utils/uuid'; * * const id = generateUUID(); // v4 UUID * const valid = isValidUUID(id); * ``` */ /** * UUID version numbers */ export declare enum UUIDVersion { /** Version 1: Timestamp-based */ V1 = 1, /** Version 4: Random */ V4 = 4, /** Version 7: Unix Epoch time-based (recommended) */ V7 = 7 } /** * Parsed UUID structure */ export interface ParsedUUID { /** Raw UUID string */ raw: string; /** UUID version */ version: UUIDVersion; /** Variant bits */ variant: number; /** Time component (for V1, V7) in milliseconds since epoch */ timestamp?: number; /** Node identifier bytes (for V1) */ node?: string; /** Random bytes (for V4) */ random?: string; /** Whether the UUID is valid */ valid: boolean; } /** * UUID format options */ export interface UUIDOptions { /** Uppercase hex output */ uppercase?: boolean; /** Include hyphens (default: true) */ hyphenated?: boolean; /** UUID version to generate (default: V4) */ version?: UUIDVersion; } /** * UUID validation result */ export interface UUIDValidationResult { /** Whether the UUID is valid */ valid: boolean; /** Version of the UUID if valid */ version?: UUIDVersion; /** Error message if invalid */ error?: string; } /** * Generate a random UUID * * @param version - UUID version to generate (default: V4) * @param options - Generation options * @returns Generated UUID string * * @example * ```typescript * const uuid = generateUUID(); * const uuidV7 = generateUUID(UUIDVersion.V7, { uppercase: true }); * ``` */ export declare function generateUUID(version?: UUIDVersion, options?: UUIDOptions): string; /** * Validate a UUID string * * @param uuid - UUID string to validate * @returns Validation result * * @example * ```typescript * const result = isValidUUID('550e8400-e29b-41d4-a716-446655440000'); * if (result.valid) { * console.log(`Valid UUID v${result.version}`); * } * ``` */ export declare function isValidUUID(uuid: string): UUIDValidationResult;