"""
AI Validators Package
Shared validation logic for AI functions
"""
from .cluster_validators import validate_minimum_keywords, validate_keyword_selection

# The codebase also contains a module-level file `ai/validators.py` which defines
# common validator helpers (e.g. `validate_ids`). Because there is both a
# package directory `ai/validators/` and a module file `ai/validators.py`, Python
# will resolve `igny8_core.ai.validators` to the package and not the module file.
# To avoid changing many imports across the project, load the module file here
# and re-export the commonly used functions.
import importlib.util
import os

_module_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'validators.py'))
if os.path.exists(_module_path):
	spec = importlib.util.spec_from_file_location('igny8_core.ai._validators_module', _module_path)
	_validators_mod = importlib.util.module_from_spec(spec)
	spec.loader.exec_module(_validators_mod)
	# Re-export commonly used functions from the module file
	validate_ids = getattr(_validators_mod, 'validate_ids', None)
	validate_keywords_exist = getattr(_validators_mod, 'validate_keywords_exist', None)
	validate_cluster_limits = getattr(_validators_mod, 'validate_cluster_limits', None)
	validate_cluster_exists = getattr(_validators_mod, 'validate_cluster_exists', None)
	validate_tasks_exist = getattr(_validators_mod, 'validate_tasks_exist', None)
	validate_api_key = getattr(_validators_mod, 'validate_api_key', None)
	validate_model = getattr(_validators_mod, 'validate_model', None)
	validate_image_size = getattr(_validators_mod, 'validate_image_size', None)
else:
	# Module file missing - keep names defined if cluster validators provide them
	validate_ids = None
	validate_keywords_exist = None
	validate_cluster_limits = None
	validate_cluster_exists = None
	validate_tasks_exist = None
	validate_api_key = None
	validate_model = None
	validate_image_size = None

__all__ = [
	'validate_minimum_keywords',
	'validate_keyword_selection',
	'validate_ids',
	'validate_keywords_exist',
	'validate_cluster_limits',
	'validate_cluster_exists',
	'validate_tasks_exist',
	'validate_api_key',
	'validate_model',
	'validate_image_size',
]
