import type { OnCallUser } from '../OnCallUser'; /** * Centralized input validation module for CalOohPay application. * * Provides consistent validation rules and error messages across all parts of the application. * All validation methods throw descriptive errors with context when validation fails. * * @category Validation */ export declare class InputValidator { /** * Validates a date string can be parsed as a valid date. * * @param dateString - The date string to validate * @param fieldName - Name of the field being validated (for error messages) * @throws {Error} If date string is invalid or cannot be parsed * * @example * ```typescript * InputValidator.validateDateString('2024-01-15', 'since'); // OK * InputValidator.validateDateString('invalid', 'since'); // throws Error * ``` */ static validateDateString(dateString: string, fieldName: string): void; /** * Validates a date range ensuring 'since' is not greater than 'until'. * * @param since - Start date string (ISO format) * @param until - End date string (ISO format) * @throws {Error} If since > until or if dates are invalid * * @example * ```typescript * InputValidator.validateDateRange('2024-01-01', '2024-01-31'); // OK * InputValidator.validateDateRange('2024-02-01', '2024-01-01'); // throws Error * ``` */ static validateDateRange(since: string, until: string): void; /** * Validates PagerDuty schedule ID format. * * PagerDuty schedule IDs typically start with 'P' followed by alphanumeric characters. * This validates basic format and non-empty strings. * * @param scheduleId - The schedule ID to validate * @throws {Error} If schedule ID is invalid * * @example * ```typescript * InputValidator.validateScheduleId('PXXXXXX'); // OK * InputValidator.validateScheduleId(''); // throws Error * InputValidator.validateScheduleId(' '); // throws Error * ``` */ static validateScheduleId(scheduleId: string): void; /** * Validates a comma-separated list of schedule IDs. * * @param scheduleIds - Comma-separated schedule IDs * @returns Array of validated and trimmed schedule IDs * @throws {Error} If any schedule ID is invalid * * @example * ```typescript * const ids = InputValidator.validateScheduleIds('PXXXXXX,PYYYYYY'); * // Returns: ['PXXXXXX', 'PYYYYYY'] * ``` */ static validateScheduleIds(scheduleIds: string): string[]; /** * Validates an IANA timezone identifier. * * Note: This performs basic validation. For comprehensive timezone validation, * use Luxon's DateTime.local().setZone() and check if zone.isValid. * * @param timezone - IANA timezone identifier (e.g., 'Europe/London', 'America/New_York') * @throws {Error} If timezone is invalid or unsupported * * @example * ```typescript * InputValidator.validateTimezone('Europe/London'); // OK * InputValidator.validateTimezone('Invalid/Timezone'); // throws Error * ``` */ static validateTimezone(timezone: string): void; /** * Validates an OnCallUser object for payment calculations. * * Ensures the user has all required data for accurate payment calculation. * * @param onCallUser - The user object to validate * @throws {Error} If user is undefined, missing required fields, or has no on-call periods * * @example * ```typescript * const user = new OnCallUser('PXXXXXX', 'John Doe', [period]); * InputValidator.validateOnCallUser(user); // OK * * InputValidator.validateOnCallUser(null); // throws Error * ``` */ static validateOnCallUser(onCallUser: OnCallUser | null | undefined): void; /** * Sanitizes a string input by trimming whitespace. * * @param input - The string to sanitize * @param defaultValue - Optional default value if input is empty after trimming * @returns Sanitized string * * @example * ```typescript * InputValidator.sanitizeString(' test '); // 'test' * InputValidator.sanitizeString(' ', 'default'); // 'default' * ``` */ static sanitizeString(input: string, defaultValue?: string): string; /** * Validates an API token format. * * Basic validation for PagerDuty API tokens. Real validation happens * when making API calls, but this catches obvious issues early. * * @param token - API token to validate * @throws {Error} If token is missing or appears invalid * * @example * ```typescript * InputValidator.validateApiToken('u+ABC123xyz789'); // OK * InputValidator.validateApiToken(''); // throws Error * ``` */ static validateApiToken(token: string): void; /** * Validates a file path for output. * * Basic validation to ensure path is not empty and doesn't contain * obviously invalid characters. * * @param filePath - The file path to validate * @throws {Error} If file path is invalid * * @example * ```typescript * InputValidator.validateFilePath('./output/report.csv'); // OK * InputValidator.validateFilePath(''); // throws Error * ``` */ static validateFilePath(filePath: string): void; /** * Validates that a number is positive (greater than 0). * * Used for validating configuration values that must be positive, * such as compensation rates. * * @param {number} value - The number to validate * @param {string} fieldName - Name of the field being validated (for error messages) * * @throws {Error} If value is not a number, NaN, or not positive * * @category Validation * * @example * ```typescript * InputValidator.validatePositiveNumber(50, 'weekdayRate'); // OK * InputValidator.validatePositiveNumber(0, 'weekdayRate'); // throws Error * InputValidator.validatePositiveNumber(-10, 'weekdayRate'); // throws Error * InputValidator.validatePositiveNumber(NaN, 'weekdayRate'); // throws Error * ``` */ static validatePositiveNumber(value: number, fieldName: string): void; /** * Validates that a string is non-empty (after trimming whitespace). * * Used for validating required string fields like currency codes. * * @param {string} value - The string to validate * @param {string} fieldName - Name of the field being validated (for error messages) * * @throws {Error} If value is not a string or is empty after trimming * * @category Validation * * @example * ```typescript * InputValidator.validateNonEmptyString('GBP', 'currency'); // OK * InputValidator.validateNonEmptyString(' USD ', 'currency'); // OK (trimmed) * InputValidator.validateNonEmptyString('', 'currency'); // throws Error * InputValidator.validateNonEmptyString(' ', 'currency'); // throws Error * ``` */ static validateNonEmptyString(value: string, fieldName: string): void; } //# sourceMappingURL=InputValidator.d.ts.map