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

from __future__ import annotations

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

from .audit_log_event import AuditLogEvent


@dataclass(slots=True)
class AuditLogEventIngestion:
    """Audit Log Event Ingestion model."""

    organization_id: str
    """The unique ID of the Organization."""
    event: "AuditLogEvent"
    """The audit log event to create."""

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

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