"""Projection of `tabs.application.researchEvidenceKind` onto list rows (no DB).

Run: cd be0 && python -m unittest tests.test_submissions_projection_research_kind -v
"""

from __future__ import annotations

import unittest
import uuid
from datetime import datetime, timezone
from types import SimpleNamespace


class SubmissionsResearchEvidenceKindProjectionTests(unittest.TestCase):
    def test_poster_without_review_round_trips_on_api_row(self) -> None:
        from src.initiative_db.submissions import _as_submission_item

        ini = SimpleNamespace(
            id=uuid.uuid4(),
            case_code="CASE-PROJ-RK",
            status="submitted",
            submitted_at=datetime(2026, 1, 1, 12, 0, 0, tzinfo=timezone.utc),
        )
        payload = {
            "submissionRecord": {
                "id": "sub-deadbeefcafe",
                "submittedDate": "2026-01-01T12:00:00.000Z",
                "name": "Test",
            },
            "tabs": {
                "application": {
                    "initiativeClassification": "research",
                    "researchEvidenceKind": "poster-without-review",
                }
            },
        }
        row = _as_submission_item(ini, payload)  # type: ignore[arg-type]
        self.assertEqual(row.get("researchEvidenceKind"), "poster-without-review")
        self.assertEqual(row.get("initiativeClassification"), "research")


if __name__ == "__main__":
    unittest.main()
