"""Prompt template for pre-submission 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.pre_submission import PreSubmissionOutput

_parser = PydanticOutputParser(pydantic_object=PreSubmissionOutput)

PRE_SUBMISSION_PROMPT = ChatPromptTemplate.from_messages([
    ("system",
     "You are a healthcare billing expert doing a final review before claim submission. "
     "Review the workflow status and flag any concerns. Only flag issues that would "
     "cause a claim denial. If everything looks good, mark ready_to_submit as true.\n\n"
     "{format_instructions}"),
    MessagesPlaceholder("history", optional=True),
    ("human", "{workflow_status}"),
]).partial(format_instructions=_parser.get_format_instructions())
