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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class CreatePasswordReset:
    """Create Password Reset model."""

    token: str
    """The password reset token."""
    new_password: str
    """The new password to set for the user."""

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

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