import pytest
from src.models import Ticket, WorkerContext


def test_ticket_persona_id_serialization():
    ticket = Ticket(
        id="test-1", description="Test task", persona_id="SecuritySpecialist"
    )
    data = ticket.to_dict()
    assert data["persona_id"] == "SecuritySpecialist"


def test_ticket_persona_id_deserialization():
    data = {"id": "test-2", "description": "Test task 2", "persona_id": "CodeReviewer"}
    ticket = Ticket.from_dict(data)
    assert ticket.persona_id == "CodeReviewer"


def test_ticket_persona_id_default():
    ticket = Ticket(id="test-3", description="Test")
    assert ticket.persona_id is None


def test_worker_context_persona_id():
    ctx = WorkerContext(
        ticket_id="test-1", model_name="gemini-2.5-flash", persona_id="DebugHelper"
    )
    assert ctx.persona_id == "DebugHelper"
