"""Prompt template for eligibility interpreter AI 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.eligibility_interpreter import EligibilityInterpreterOutput

_parser = PydanticOutputParser(pydantic_object=EligibilityInterpreterOutput)

ELIGIBILITY_INTERPRETER_PROMPT = ChatPromptTemplate.from_messages([
    ("system",
     "You are a healthcare eligibility analyst. Interpret this eligibility response "
     "data and determine:\n1. Whether the patient has active coverage\n"
     "2. Plan details (copay, deductible, out-of-pocket)\n"
     "3. Any coverage concerns or limitations\n\n"
     "IMPORTANT: Do not include any patient-identifying information.\n\n{format_instructions}"),
    MessagesPlaceholder("history", optional=True),
    ("human", "{eligibility_response}"),
]).partial(format_instructions=_parser.get_format_instructions())
