"""Tests for GUI profile persistence."""

from __future__ import annotations

import unittest

from python_app.models.gui_profile_model import (
    GuiPassThroughStateModel,
    GuiProcessingStateModel,
    GuiProfileModel,
    GuiStateModel,
)


class GuiProfileCodecTest(unittest.TestCase):
    def test_pass_through_combo_filter_round_trips(self) -> None:
        profile = GuiProfileModel(
            gui=GuiStateModel(
                processing=GuiProcessingStateModel(
                    pass_through=GuiPassThroughStateModel(combo_filter="0:0,1:0")
                )
            )
        )

        encoded = profile.to_dict()
        decoded = GuiProfileModel.from_dict(encoded)

        self.assertIsNotNone(decoded.gui)
        assert decoded.gui is not None
        self.assertEqual(decoded.gui.processing.pass_through.combo_filter, "0:0,1:0")
        self.assertEqual(encoded["gui"]["processing"]["pass_through"]["combo_filter"], "0:0,1:0")


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