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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class DataIntegrationsVendCredentialsRequest:
    """Data Integrations Vend Credentials Request model."""

    user_id: str
    """A [User](https://workos.com/docs/reference/authkit/user) identifier."""
    organization_id: str | None = None
    """An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization."""

    @classmethod
    def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsVendCredentialsRequest:
        """Deserialize from a dictionary."""
        try:
            return cls(
                user_id=data["user_id"],
                organization_id=data.get("organization_id"),
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("DataIntegrationsVendCredentialsRequest", e)

    def to_dict(self) -> dict[str, Any]:
        """Serialize to a dictionary."""
        result: dict[str, Any] = {}
        result["user_id"] = self.user_id
        if self.organization_id is not None:
            result["organization_id"] = self.organization_id
        return result
