{% from "macros.html" import dep_compare_block, evidence_details, plain_summary %}

{{ t('cf.case_file') }} {{ case.request_id }}

{{ t('cf.project') }}: {{ project.name if project else case.project_id }} · {{ t('cf.status') }}: {{ case.status.value|tr_status }} · "{{ case.raw_request }}"

{% for d in case.decisions %}
{{ d.decision.value|tr_decision }} {{ t('ev.confidence') }} {{ '%.0f'|format(d.confidence * 100) }}% · PMO: {{ d.human_decision.value|tr_status }} {% if d.risk.escalation %}{{ t('ev.escalation_24') }}{% endif %}

{{ case.sub_requests[loop.index0].item }}

{{ plain_summary(d) }}

{{ t('ps.effort_if_cr') if d.decision.value == 'OUT_OF_SCOPE' else t('ps.effort') }} {{ d.effort_estimate.low }}–{{ d.effort_estimate.high }} {{ d.effort_estimate.unit|tr_unit }} · {{ t('ev.risk') }} {{ d.risk.level.value|tr_risk }} · {{ t('cf.impacted_if_cr') if d.decision.value == 'OUT_OF_SCOPE' else t('cf.impacted') }}: {{ d.evidence.impacted_modules|join(', ') or '—' }} · {{ t('cards.index') }} {{ d.index_freshness }}

{{ evidence_details(d) }} {% set _dep = dep_compare[loop.index0] if dep_compare is defined and dep_compare and loop.index0 < dep_compare|length else none %} {% if _dep %}{{ dep_compare_block(case, _dep, loop.index0, deps_online if deps_online is defined else false) }}{% endif %} {% set _cid = d.evidence.cited_clauses[0].id if d.evidence.cited_clauses else (d.evidence.contract_clauses_cited[0] if d.evidence.contract_clauses_cited else none) %} {% set _mem = clause_memory.get(_cid) if clause_memory is defined and clause_memory and _cid else none %} {% if _mem %}
🗂 {{ t('cf.memory_title') }}{% if _mem.ref %} · {{ _mem.ref }}{% endif %} {% if _mem.count %}{{ t('cf.memory_precedents', n=_mem.count) }}{% if _mem.last %} · {{ t('cf.memory_last', v=_mem.last) }}{% endif %}{% endif %} {% if _mem.disputed %}⚠ {{ t('cf.memory_disputed') }}{% endif %}
{% endif %} {% if d.human_decision.value == 'PENDING' and (request.session.get('user') or {}).get('role') == 'pmo' %}

{% endif %}
{% endfor %} {% include "case_flow.html" %} {% if pre_analysis_html or chat_turns_html %}
{{ t('cf.pre_analysis') }}{% if chat_turns_html %} · {{ t('cf.pre_analysis_chat') }} ({{ t('cf.turns', n=chat_turns_html|length) }}){% endif %} {% if pre_analysis_html %}
{{ pre_analysis_html|safe }}
{% endif %} {% for turn in chat_turns_html %}
{{ turn.question }}
{{ turn.answer_html|safe }}
{% endfor %}
{% endif %}
{{ t('cf.audit_summary', n=audit|length) }}
{% for e in audit %}
#{{ e.seq }} · {{ e.action }}
{{ e.actor }} {% for key, val in e.detail.items() %}{{ key }}={{ val }} {% endfor %}
{% endfor %}
{{ t('cf.how_to_read') }}

{{ t('cf.how_to_read_desc')|safe }}