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

from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict
from workos._types import _raise_deserialize_error
from .vault_data_deleted_data_actor_source import VaultDataDeletedDataActorSource


@dataclass(slots=True)
class VaultDataDeletedData:
    """The event payload."""

    actor_id: str
    """The unique identifier of the actor."""
    actor_source: "VaultDataDeletedDataActorSource"
    actor_name: str
    """The name of the actor."""
    kv_name: str
    """The name of the key-value store."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "VaultDataDeletedData":
        """Deserialize from a dictionary."""
        try:
            return cls(
                actor_id=data["actor_id"],
                actor_source=VaultDataDeletedDataActorSource(data["actor_source"]),
                actor_name=data["actor_name"],
                kv_name=data["kv_name"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("VaultDataDeletedData", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        result["actor_id"] = self.actor_id
        result["actor_source"] = (
            self.actor_source.value
            if isinstance(self.actor_source, Enum)
            else self.actor_source
        )
        result["actor_name"] = self.actor_name
        result["kv_name"] = self.kv_name
        return result
