"""Prompt template for eligibility rejection summary chain."""
from __future__ import annotations
from langchain_core.output_parsers import PydanticOutputParser
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from claim_validator.chains.output_schemas.rejection_summary import RejectionSummaryOutput

_parser = PydanticOutputParser(pydantic_object=RejectionSummaryOutput)

REJECTION_SUMMARY_PROMPT = ChatPromptTemplate.from_messages([
    ("system",
     "You are a healthcare billing expert. Summarize why this eligibility check "
     "failed in plain language for billing staff. Include specific suggestions to "
     "fix each issue. Be concise.\n\n{format_instructions}"),
    MessagesPlaceholder("history", optional=True),
    ("human", "{findings_text}"),
]).partial(format_instructions=_parser.get_format_instructions())
