# 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.organization_domains.models import OrganizationDomain


class TestModelRoundTrip:
    def test_organization_domain_round_trip(self):
        data = load_fixture("organization_domain.json")
        instance = OrganizationDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = OrganizationDomain.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_organization_domain_minimal_payload(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomain.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["organization_id"] == data["organization_id"]
        assert serialized["domain"] == data["domain"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_organization_domain_omits_absent_optional_non_nullable_fields(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomain.from_dict(data)
        serialized = instance.to_dict()
        assert "state" not in serialized
        assert "verification_prefix" not in serialized
        assert "verification_token" not in serialized
        assert "verification_strategy" not in serialized

    def test_organization_domain_round_trips_unknown_enum_values(self):
        data = {
            "object": "organization_domain",
            "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
            "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
            "domain": "foo-corp.com",
            "state": "unexpected_organization_domain_state",
            "verification_prefix": "superapp-domain-verification-z3kjny",
            "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
            "verification_strategy": "dns",
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = OrganizationDomain.from_dict(data)
        assert instance.to_dict() == data
