/** * Validation types and utilities for async card interaction validation */ /** * Result of a validation operation * * @property valid - Whether the operation is allowed * @property error - Optional error message if validation fails * * @example * ```ts * const result: ValidationResult = { * valid: true * }; * * const errorResult: ValidationResult = { * valid: false, * error: 'Cannot move card to this zone' * }; * ``` */ export interface ValidationResult { /** Whether the operation is allowed */ valid: boolean; /** Optional error message if validation fails */ error?: string; } /** * Validator function for drag start operations * @param cardId - The ID of the card being dragged * @param cardData - Optional additional card data * @returns Promise resolving to validation result */ export type DragStartValidator = (cardId: string, cardData?: unknown) => Promise; /** * Validator function for drag end (drop) operations * @param cardId - The ID of the card being dropped * @param fromZone - The zone the card is being dragged from * @param toZone - The zone the card is being dropped to * @param cardData - Optional additional card data * @returns Promise resolving to validation result */ export type DragEndValidator = (cardId: string, fromZone: string, toZone: string, cardData?: unknown) => Promise; /** * Validator function for hand reordering operations * @param cardId - The ID of the card being reordered * @param fromIndex - The original index of the card * @param toIndex - The target index for the card * @returns Promise resolving to validation result */ export type ReorderValidator = (cardId: string, fromIndex: number, toIndex: number) => Promise; /** * Validator function for deck draw operations * @returns Promise resolving to validation result */ export type DrawValidator = () => Promise; /** * Helper function to create a successful validation result */ export declare const createValidResult: () => ValidationResult; /** * Helper function to create an invalid validation result with error message */ export declare const createInvalidResult: (error: string) => ValidationResult;