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

from __future__ import annotations

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


@dataclass(slots=True)
class RekeyRequest:
    """Rekey Request model."""

    context: Dict[str, str]
    """Map of values used to determine the new encryption key."""
    encrypted_keys: str
    """Base64-encoded encrypted data key blob to re-encrypt."""

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

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