import { StaticTranslationKey } from '../../translation/interface';

export type TranslationEntry<T> = { key: T; args?: unknown[] };

export type TranslationMessage<T> = T | TranslationEntry<T> | '';

export interface EvaluateResultBase {
	isValid: boolean;
	message: string;
}

export type EvaluateResult<T = string> = EvaluateResultBase | EvaluateResultTranslation<T>;

export interface EvaluateResultTranslation<T = StaticTranslationKey>
	extends Omit<EvaluateResultBase, 'message'> {
	message: TranslationMessage<T>;
}

export interface ValidationRule<T> {
	canEvaluate(input: unknown): boolean;
	evaluate(input: T): EvaluateResult | Promise<EvaluateResult>;
}
