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

from __future__ import annotations

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


@dataclass(slots=True)
class RadarStandaloneUpdateRadarAttemptRequest:
    """Radar Standalone Update Radar Attempt Request model."""

    challenge_status: Optional[Literal["success"]] = None
    """Set to `"success"` to mark the challenge as completed."""
    attempt_status: Optional[Literal["success"]] = None
    """Set to `"success"` to mark the authentication attempt as successful."""

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

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