# 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 CreateObjectRequest:
    """Create Object Request model."""

    key_context: Dict[str, str]
    """Map of values used to determine the encryption key."""
    name: str
    """Unique name for the object."""
    value: str
    """Plaintext data to encrypt and store."""

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

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