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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Literal, cast

from workos._types import _raise_deserialize_error

from .data_integration_configuration_response import (
    DataIntegrationConfigurationResponse,
)


@dataclass(slots=True)
class DataIntegrationConfigurationListResponse:
    """Data Integration Configuration List Response model."""

    object: Literal["list"]
    """Indicates this is a list response."""
    data: list[DataIntegrationConfigurationResponse]
    """A list of data integration configurations for the organization."""

    @classmethod
    def from_dict(
        cls, data: dict[str, Any]
    ) -> DataIntegrationConfigurationListResponse:
        """Deserialize from a dictionary."""
        try:
            return cls(
                object=data.get("object", "list"),
                data=[
                    DataIntegrationConfigurationResponse.from_dict(
                        cast(dict[str, Any], item)
                    )
                    for item in cast(list[Any], data["data"])
                ],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("DataIntegrationConfigurationListResponse", e)

    def to_dict(self) -> dict[str, Any]:
        """Serialize to a dictionary."""
        result: dict[str, Any] = {}
        result["object"] = self.object
        result["data"] = [item.to_dict() for item in self.data]
        return result
