"""Eligibility rejection summary 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
from claim_validator.chains.output_schemas.rejection_summary import RejectionSummaryOutput
from claim_validator.chains.prompts.rejection_summary import REJECTION_SUMMARY_PROMPT

def build_rejection_summary_chain(config: dict[str, Any], memory_manager: MemoryManager | None = None) -> RunnableSerializable:
    return build_chain(prompt=REJECTION_SUMMARY_PROMPT, output_schema=RejectionSummaryOutput, config=config,
                       memory_manager=memory_manager, input_key="findings_text")
