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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict, Optional
from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class AuthenticationSSOFailedDataSSO:
    """SSO connection details."""

    organization_id: Optional[str]
    """The ID of the organization."""
    connection_id: Optional[str]
    """The ID of the SSO connection."""
    session_id: Optional[str]
    """The ID of the SSO session."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOFailedDataSSO":
        """Deserialize from a dictionary."""
        try:
            return cls(
                organization_id=data["organization_id"],
                connection_id=data["connection_id"],
                session_id=data["session_id"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("AuthenticationSSOFailedDataSSO", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        if self.organization_id is not None:
            result["organization_id"] = self.organization_id
        else:
            result["organization_id"] = None
        if self.connection_id is not None:
            result["connection_id"] = self.connection_id
        else:
            result["connection_id"] = None
        if self.session_id is not None:
            result["session_id"] = self.session_id
        else:
            result["session_id"] = None
        return result
