# 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_byok_key_provider import VaultByokKeyProvider


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

    organization_id: str
    """The unique identifier of the organization."""
    key_provider: "VaultByokKeyProvider"
    verified: bool
    """Whether the BYOK key verification completed successfully."""

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

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