import { ErrorLevel, ErrorSources, ErrorType as ValidationErrorType } from "../../../types"

// Define our own Error type that's compatible with the original
export interface ErrorType {
  message: string;
  level: ErrorLevel;
  source?: ErrorSources;
  type: ValidationErrorType;
}

// Export a namespace to make it accessible at runtime
export const ErrorTypes = {
  createError: (message: string, level: ErrorLevel = 'error', source: ErrorSources = ErrorSources.Row, type: ValidationErrorType = ValidationErrorType.Custom): ErrorType => {
    return { message, level, source, type };
  }
};

// Type for a collection of errors
export interface Errors { [id: string]: ErrorType[] }

// Make our Meta type match the original for compatibility
export interface Meta { 
  __index?: string; 
} 