"""Code validation chain builder."""
from __future__ import annotations
from typing import Any
from langchain_core.runnables import RunnableSerializable
from claim_validator.chains.base import build_chain
from claim_validator.chains.memory.manager import MemoryManager, MemoryType
from claim_validator.chains.output_schemas.code_validation import CodeValidationOutput
from claim_validator.chains.prompts.code_validation import CODE_VALIDATION_PROMPT

def build_code_validation_chain(config: dict[str, Any], memory_manager: MemoryManager | None = None) -> RunnableSerializable:
    return build_chain(prompt=CODE_VALIDATION_PROMPT, output_schema=CodeValidationOutput, config=config,
                       memory_manager=memory_manager, memory_type=MemoryType.WITHIN_CLAIM, input_key="claim_data")
