# 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_names_listed_data_actor_source import VaultNamesListedDataActorSource


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

    actor_id: str
    """The unique identifier of the actor."""
    actor_source: "VaultNamesListedDataActorSource"
    actor_name: str
    """The name of the actor."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "VaultNamesListedData":
        """Deserialize from a dictionary."""
        try:
            return cls(
                actor_id=data["actor_id"],
                actor_source=VaultNamesListedDataActorSource(data["actor_source"]),
                actor_name=data["actor_name"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("VaultNamesListedData", 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
        return result
