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

from __future__ import annotations
from .workflowregistrationref_output import (
    WorkflowRegistrationRefOutput,
    WorkflowRegistrationRefOutputTypedDict,
)
from mistralai.workflows.worker_client.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class WorkflowSpecsRegisterResponseTypedDict(TypedDict):
    has_conflicts: bool
    r"""Whether one of the provided workflow specs has already been registered"""
    workflow_version_ids: NotRequired[List[str]]
    r"""Deprecated: use workflow_registration_ids"""
    workflow_registration_ids: NotRequired[List[str]]
    r"""List of workflow IDs that were registered"""
    workflow_version_refs: NotRequired[List[WorkflowRegistrationRefOutputTypedDict]]
    r"""Deprecated: use workflow_registration_refs"""
    workflow_registration_refs: NotRequired[
        List[WorkflowRegistrationRefOutputTypedDict]
    ]
    r"""List of workflow registration references"""
    warnings: NotRequired[List[str]]
    r"""Non-fatal warnings produced during registration"""


class WorkflowSpecsRegisterResponse(BaseModel):
    has_conflicts: bool
    r"""Whether one of the provided workflow specs has already been registered"""

    workflow_version_ids: Optional[List[str]] = None
    r"""Deprecated: use workflow_registration_ids"""

    workflow_registration_ids: Optional[List[str]] = None
    r"""List of workflow IDs that were registered"""

    workflow_version_refs: Optional[List[WorkflowRegistrationRefOutput]] = None
    r"""Deprecated: use workflow_registration_refs"""

    workflow_registration_refs: Optional[List[WorkflowRegistrationRefOutput]] = None
    r"""List of workflow registration references"""

    warnings: Optional[List[str]] = None
    r"""Non-fatal warnings produced during registration"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "workflow_version_ids",
                "workflow_registration_ids",
                "workflow_version_refs",
                "workflow_registration_refs",
                "warnings",
            ]
        )
        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:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
