"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 3752e5b776db

from __future__ import annotations
from .workflowregistration import WorkflowRegistration, WorkflowRegistrationTypedDict
from mistralai.client.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List
from typing_extensions import TypedDict


class WorkflowRegistrationListResponseTypedDict(TypedDict):
    workflow_registrations: List[WorkflowRegistrationTypedDict]
    r"""A list of workflow registrations"""
    next_cursor: Nullable[str]
    workflow_versions: List[WorkflowRegistrationTypedDict]
    r"""Deprecated: use workflow_registrations"""


class WorkflowRegistrationListResponse(BaseModel):
    workflow_registrations: List[WorkflowRegistration]
    r"""A list of workflow registrations"""

    next_cursor: Nullable[str]

    workflow_versions: List[WorkflowRegistration]
    r"""Deprecated: use workflow_registrations"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                m[k] = val

        return m
