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

from __future__ import annotations

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

from workos.common.models.user import User


@dataclass(slots=True)
class ResetPasswordResponse:
    """Reset Password Response model."""

    user: "User"
    """The user whose password was reset."""

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

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