"""因子元数据管理模块。

提供基于DuckDB查询JSONL文件、零拷贝输出Polars DataFrame的因子管理能力。

核心组件:
    - FactorManager: 元数据管理器主类
    - FactorValidator: 字段校验器
    - 异常类: FactorMetadataError, ValidationError等

使用示例:
    >>> from src.factors.metadata import FactorManager
    >>>
    >>> # 初始化管理器
    >>> manager = FactorManager("data/factors.jsonl")
    >>>
    >>> # 添加因子
    >>> manager.add_factor({
    ...     "factor_id": "F_001",
    ...     "name": "mom_5d",
    ...     "desc": "5日价格动量截面排序",
    ...     "dsl": "cs_rank(close / delay(close, 5) - 1)"
    ... })
    >>>
    >>> # 查询因子
    >>> df = manager.search_factors("name LIKE 'mom_%'")
    >>> print(df)
"""

from src.factors.metadata.manager import FactorManager
from src.factors.metadata.validator import FactorValidator
from src.factors.metadata.exceptions import (
    FactorMetadataError,
    ValidationError,
    DuplicateFactorError,
    FactorNotFoundError,
    QueryError,
    FileOperationError,
)

__all__ = [
    # 管理器
    "FactorManager",
    # 校验器
    "FactorValidator",
    # 异常类
    "FactorMetadataError",
    "ValidationError",
    "DuplicateFactorError",
    "FactorNotFoundError",
    "QueryError",
    "FileOperationError",
]
