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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Literal

from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class AuthMethodMismatchError:
    """Auth Method Mismatch Error model."""

    code: Literal["auth_method_mismatch"]
    """Error code indicating the endpoint does not match the installation auth method."""
    message: str
    """A human-readable explanation of the mismatch."""

    @classmethod
    def from_dict(cls, data: dict[str, Any]) -> AuthMethodMismatchError:
        """Deserialize from a dictionary."""
        try:
            return cls(
                code=data.get("code", "auth_method_mismatch"),
                message=data["message"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("AuthMethodMismatchError", e)

    def to_dict(self) -> dict[str, Any]:
        """Serialize to a dictionary."""
        result: dict[str, Any] = {}
        result["code"] = self.code
        result["message"] = self.message
        return result
