import { DiscountType } from './models/ReferralCode'; import type { CreateCodeResponse, VerifyCodeResponse, IncrementUsageResponse } from './controllers/referralController'; export interface CoupanCodeSDKConfig { apiKey: string; clientId: string; } /** * Coupan Code SDK - Main entry point for using the package * Similar to AWS SDK pattern where you initialize with credentials */ export declare class CoupanCodeSDK { private apiKey; private clientId; private isInitialized; private validatedClientId?; constructor(config: CoupanCodeSDKConfig); /** * Initialize the SDK - validates API key and connects to database * Must be called before using any other methods * Uses optimized connection pooling and retry logic * @returns Promise that resolves when initialization is complete * @throws Error if API key is invalid or database connection fails */ init(): Promise; /** * Ensure SDK is initialized * @private */ private ensureInitialized; /** * Creates a new referral code * @param discountType - Type of discount ('percentage' | 'amount') * @param discountValue - Discount value (percentage 0-100 or fixed amount) * @param usageLimit - Optional maximum usage limit * @param code - Optional custom referral code. If provided, will validate it with clientId and check if it's available * @returns CreateCodeResponse with generated code or error */ createCode(discountType: DiscountType, discountValue: number, usageLimit?: number, code?: string): Promise; /** * Verifies a referral code and returns validation status with discount information * @param code - The referral code to verify * @param originalAmount - Optional original amount for discount calculation * @returns VerifyCodeResponse with validation status and discount info */ verifyCode(code: string, originalAmount?: number): Promise; /** * Increments the usage count of a referral code * Automatically deactivates if usage limit is reached * @param code - The referral code to increment usage for * @returns IncrementUsageResponse with updated usage count and active status */ incrementUsage(code: string): Promise; /** * Get the validated client ID * @returns Client ID that was validated during init */ getClientId(): string; /** * Check if SDK is initialized * @returns True if initialized, false otherwise */ isReady(): boolean; }