# This file is auto-generated by oagen. Do not edit.

"""Model round-trip tests: from_dict(to_dict()) preserves data."""

from tests.generated_helpers import load_fixture

from workos.radar.models import (
    RadarListEntryAlreadyPresentResponse,
    RadarStandaloneResponse,
)


class TestModelRoundTrip:
    def test_radar_standalone_response_round_trip(self):
        data = load_fixture("radar_standalone_response.json")
        instance = RadarStandaloneResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RadarStandaloneResponse.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_radar_standalone_response_minimal_payload(self):
        data = {
            "verdict": "block",
            "reason": "Detected enabled Radar control",
            "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X",
        }
        instance = RadarStandaloneResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["verdict"] == data["verdict"]
        assert serialized["reason"] == data["reason"]
        assert serialized["attempt_id"] == data["attempt_id"]

    def test_radar_standalone_response_omits_absent_optional_non_nullable_fields(self):
        data = {
            "verdict": "block",
            "reason": "Detected enabled Radar control",
            "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X",
        }
        instance = RadarStandaloneResponse.from_dict(data)
        serialized = instance.to_dict()
        assert "control" not in serialized
        assert "blocklist_type" not in serialized

    def test_radar_standalone_response_round_trips_unknown_enum_values(self):
        data = {
            "verdict": "unexpected_radar_standalone_response_verdict",
            "reason": "Detected enabled Radar control",
            "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X",
            "control": "bot_detection",
            "blocklist_type": "ip_address",
        }
        instance = RadarStandaloneResponse.from_dict(data)
        assert instance.to_dict() == data

    def test_radar_list_entry_already_present_response_round_trip(self):
        data = load_fixture("radar_list_entry_already_present_response.json")
        instance = RadarListEntryAlreadyPresentResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = RadarListEntryAlreadyPresentResponse.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_radar_list_entry_already_present_response_minimal_payload(self):
        data = {"message": "Entry already present in list"}
        instance = RadarListEntryAlreadyPresentResponse.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["message"] == data["message"]
