# coding: utf-8

"""
    Agent Service

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from asteroid_odyssey.models.agents_execution_agent_query_context_completed_details import AgentsExecutionAgentQueryContextCompletedDetails
from asteroid_odyssey.models.agents_execution_browser_run_code_completed_details import AgentsExecutionBrowserRunCodeCompletedDetails
from asteroid_odyssey.models.agents_execution_element_file_upload_completed_details import AgentsExecutionElementFileUploadCompletedDetails
from asteroid_odyssey.models.agents_execution_ext_api_call_completed_details import AgentsExecutionExtApiCallCompletedDetails
from asteroid_odyssey.models.agents_execution_ext_get_mail_completed_details import AgentsExecutionExtGetMailCompletedDetails
from asteroid_odyssey.models.agents_execution_file_list_completed_details import AgentsExecutionFileListCompletedDetails
from asteroid_odyssey.models.agents_execution_file_read_completed_details import AgentsExecutionFileReadCompletedDetails
from asteroid_odyssey.models.agents_execution_file_stage_completed_details import AgentsExecutionFileStageCompletedDetails
from asteroid_odyssey.models.agents_execution_nav_to_completed_details import AgentsExecutionNavToCompletedDetails
from asteroid_odyssey.models.agents_execution_obs_snapshot_with_selectors_completed_details import AgentsExecutionObsSnapshotWithSelectorsCompletedDetails
from asteroid_odyssey.models.agents_execution_scratchpad_read_completed_details import AgentsExecutionScratchpadReadCompletedDetails
from asteroid_odyssey.models.agents_execution_scratchpad_write_completed_details import AgentsExecutionScratchpadWriteCompletedDetails
from asteroid_odyssey.models.agents_execution_script_eval_completed_details import AgentsExecutionScriptEvalCompletedDetails
from asteroid_odyssey.models.agents_execution_script_hybrid_playwright_completed_details import AgentsExecutionScriptHybridPlaywrightCompletedDetails
from asteroid_odyssey.models.agents_execution_script_pad_run_function_completed_details import AgentsExecutionScriptPadRunFunctionCompletedDetails
from asteroid_odyssey.models.agents_execution_script_playwright_completed_details import AgentsExecutionScriptPlaywrightCompletedDetails
from asteroid_odyssey.models.agents_execution_scriptpad_read_completed_details import AgentsExecutionScriptpadReadCompletedDetails
from asteroid_odyssey.models.agents_execution_scriptpad_search_replace_completed_details import AgentsExecutionScriptpadSearchReplaceCompletedDetails
from asteroid_odyssey.models.agents_execution_scriptpad_write_completed_details import AgentsExecutionScriptpadWriteCompletedDetails
from asteroid_odyssey.models.agents_execution_util_get_datetime_completed_details import AgentsExecutionUtilGetDatetimeCompletedDetails
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

AGENTSEXECUTIONACTIVITYACTIONCOMPLETEDINFO_ONE_OF_SCHEMAS = ["AgentsExecutionAgentQueryContextCompletedDetails", "AgentsExecutionBrowserRunCodeCompletedDetails", "AgentsExecutionElementFileUploadCompletedDetails", "AgentsExecutionExtApiCallCompletedDetails", "AgentsExecutionExtGetMailCompletedDetails", "AgentsExecutionFileListCompletedDetails", "AgentsExecutionFileReadCompletedDetails", "AgentsExecutionFileStageCompletedDetails", "AgentsExecutionNavToCompletedDetails", "AgentsExecutionObsSnapshotWithSelectorsCompletedDetails", "AgentsExecutionScratchpadReadCompletedDetails", "AgentsExecutionScratchpadWriteCompletedDetails", "AgentsExecutionScriptEvalCompletedDetails", "AgentsExecutionScriptHybridPlaywrightCompletedDetails", "AgentsExecutionScriptPadRunFunctionCompletedDetails", "AgentsExecutionScriptPlaywrightCompletedDetails", "AgentsExecutionScriptpadReadCompletedDetails", "AgentsExecutionScriptpadSearchReplaceCompletedDetails", "AgentsExecutionScriptpadWriteCompletedDetails", "AgentsExecutionUtilGetDatetimeCompletedDetails"]

class AgentsExecutionActivityActionCompletedInfo(BaseModel):
    """
    AgentsExecutionActivityActionCompletedInfo
    """
    # data type: AgentsExecutionExtApiCallCompletedDetails
    oneof_schema_1_validator: Optional[AgentsExecutionExtApiCallCompletedDetails] = None
    # data type: AgentsExecutionScratchpadReadCompletedDetails
    oneof_schema_2_validator: Optional[AgentsExecutionScratchpadReadCompletedDetails] = None
    # data type: AgentsExecutionScratchpadWriteCompletedDetails
    oneof_schema_3_validator: Optional[AgentsExecutionScratchpadWriteCompletedDetails] = None
    # data type: AgentsExecutionScriptPlaywrightCompletedDetails
    oneof_schema_4_validator: Optional[AgentsExecutionScriptPlaywrightCompletedDetails] = None
    # data type: AgentsExecutionScriptHybridPlaywrightCompletedDetails
    oneof_schema_5_validator: Optional[AgentsExecutionScriptHybridPlaywrightCompletedDetails] = None
    # data type: AgentsExecutionBrowserRunCodeCompletedDetails
    oneof_schema_6_validator: Optional[AgentsExecutionBrowserRunCodeCompletedDetails] = None
    # data type: AgentsExecutionScriptEvalCompletedDetails
    oneof_schema_7_validator: Optional[AgentsExecutionScriptEvalCompletedDetails] = None
    # data type: AgentsExecutionFileReadCompletedDetails
    oneof_schema_8_validator: Optional[AgentsExecutionFileReadCompletedDetails] = None
    # data type: AgentsExecutionFileListCompletedDetails
    oneof_schema_9_validator: Optional[AgentsExecutionFileListCompletedDetails] = None
    # data type: AgentsExecutionFileStageCompletedDetails
    oneof_schema_10_validator: Optional[AgentsExecutionFileStageCompletedDetails] = None
    # data type: AgentsExecutionElementFileUploadCompletedDetails
    oneof_schema_11_validator: Optional[AgentsExecutionElementFileUploadCompletedDetails] = None
    # data type: AgentsExecutionExtGetMailCompletedDetails
    oneof_schema_12_validator: Optional[AgentsExecutionExtGetMailCompletedDetails] = None
    # data type: AgentsExecutionScriptPadRunFunctionCompletedDetails
    oneof_schema_13_validator: Optional[AgentsExecutionScriptPadRunFunctionCompletedDetails] = None
    # data type: AgentsExecutionScriptpadReadCompletedDetails
    oneof_schema_14_validator: Optional[AgentsExecutionScriptpadReadCompletedDetails] = None
    # data type: AgentsExecutionScriptpadWriteCompletedDetails
    oneof_schema_15_validator: Optional[AgentsExecutionScriptpadWriteCompletedDetails] = None
    # data type: AgentsExecutionScriptpadSearchReplaceCompletedDetails
    oneof_schema_16_validator: Optional[AgentsExecutionScriptpadSearchReplaceCompletedDetails] = None
    # data type: AgentsExecutionObsSnapshotWithSelectorsCompletedDetails
    oneof_schema_17_validator: Optional[AgentsExecutionObsSnapshotWithSelectorsCompletedDetails] = None
    # data type: AgentsExecutionUtilGetDatetimeCompletedDetails
    oneof_schema_18_validator: Optional[AgentsExecutionUtilGetDatetimeCompletedDetails] = None
    # data type: AgentsExecutionNavToCompletedDetails
    oneof_schema_19_validator: Optional[AgentsExecutionNavToCompletedDetails] = None
    # data type: AgentsExecutionAgentQueryContextCompletedDetails
    oneof_schema_20_validator: Optional[AgentsExecutionAgentQueryContextCompletedDetails] = None
    actual_instance: Optional[Union[AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails]] = None
    one_of_schemas: Set[str] = { "AgentsExecutionAgentQueryContextCompletedDetails", "AgentsExecutionBrowserRunCodeCompletedDetails", "AgentsExecutionElementFileUploadCompletedDetails", "AgentsExecutionExtApiCallCompletedDetails", "AgentsExecutionExtGetMailCompletedDetails", "AgentsExecutionFileListCompletedDetails", "AgentsExecutionFileReadCompletedDetails", "AgentsExecutionFileStageCompletedDetails", "AgentsExecutionNavToCompletedDetails", "AgentsExecutionObsSnapshotWithSelectorsCompletedDetails", "AgentsExecutionScratchpadReadCompletedDetails", "AgentsExecutionScratchpadWriteCompletedDetails", "AgentsExecutionScriptEvalCompletedDetails", "AgentsExecutionScriptHybridPlaywrightCompletedDetails", "AgentsExecutionScriptPadRunFunctionCompletedDetails", "AgentsExecutionScriptPlaywrightCompletedDetails", "AgentsExecutionScriptpadReadCompletedDetails", "AgentsExecutionScriptpadSearchReplaceCompletedDetails", "AgentsExecutionScriptpadWriteCompletedDetails", "AgentsExecutionUtilGetDatetimeCompletedDetails" }

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
    )


    discriminator_value_class_map: Dict[str, str] = {
    }

    def __init__(self, *args, **kwargs) -> None:
        if args:
            if len(args) > 1:
                raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
            if kwargs:
                raise ValueError("If a position argument is used, keyword arguments cannot be used.")
            super().__init__(actual_instance=args[0])
        else:
            super().__init__(**kwargs)

    @field_validator('actual_instance')
    def actual_instance_must_validate_oneof(cls, v):
        instance = AgentsExecutionActivityActionCompletedInfo.model_construct()
        error_messages = []
        match = 0
        # validate data type: AgentsExecutionExtApiCallCompletedDetails
        if not isinstance(v, AgentsExecutionExtApiCallCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionExtApiCallCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScratchpadReadCompletedDetails
        if not isinstance(v, AgentsExecutionScratchpadReadCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScratchpadReadCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScratchpadWriteCompletedDetails
        if not isinstance(v, AgentsExecutionScratchpadWriteCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScratchpadWriteCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptPlaywrightCompletedDetails
        if not isinstance(v, AgentsExecutionScriptPlaywrightCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptPlaywrightCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptHybridPlaywrightCompletedDetails
        if not isinstance(v, AgentsExecutionScriptHybridPlaywrightCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptHybridPlaywrightCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionBrowserRunCodeCompletedDetails
        if not isinstance(v, AgentsExecutionBrowserRunCodeCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionBrowserRunCodeCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptEvalCompletedDetails
        if not isinstance(v, AgentsExecutionScriptEvalCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptEvalCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionFileReadCompletedDetails
        if not isinstance(v, AgentsExecutionFileReadCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionFileReadCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionFileListCompletedDetails
        if not isinstance(v, AgentsExecutionFileListCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionFileListCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionFileStageCompletedDetails
        if not isinstance(v, AgentsExecutionFileStageCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionFileStageCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionElementFileUploadCompletedDetails
        if not isinstance(v, AgentsExecutionElementFileUploadCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionElementFileUploadCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionExtGetMailCompletedDetails
        if not isinstance(v, AgentsExecutionExtGetMailCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionExtGetMailCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptPadRunFunctionCompletedDetails
        if not isinstance(v, AgentsExecutionScriptPadRunFunctionCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptPadRunFunctionCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptpadReadCompletedDetails
        if not isinstance(v, AgentsExecutionScriptpadReadCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptpadReadCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptpadWriteCompletedDetails
        if not isinstance(v, AgentsExecutionScriptpadWriteCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptpadWriteCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionScriptpadSearchReplaceCompletedDetails
        if not isinstance(v, AgentsExecutionScriptpadSearchReplaceCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionScriptpadSearchReplaceCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionObsSnapshotWithSelectorsCompletedDetails
        if not isinstance(v, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionObsSnapshotWithSelectorsCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionUtilGetDatetimeCompletedDetails
        if not isinstance(v, AgentsExecutionUtilGetDatetimeCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionUtilGetDatetimeCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionNavToCompletedDetails
        if not isinstance(v, AgentsExecutionNavToCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionNavToCompletedDetails`")
        else:
            match += 1
        # validate data type: AgentsExecutionAgentQueryContextCompletedDetails
        if not isinstance(v, AgentsExecutionAgentQueryContextCompletedDetails):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AgentsExecutionAgentQueryContextCompletedDetails`")
        else:
            match += 1
        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when setting `actual_instance` in AgentsExecutionActivityActionCompletedInfo with oneOf schemas: AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when setting `actual_instance` in AgentsExecutionActivityActionCompletedInfo with oneOf schemas: AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails. Details: " + ", ".join(error_messages))
        else:
            return v

    @classmethod
    def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
        return cls.from_json(json.dumps(obj))

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Returns the object represented by the json string"""
        instance = cls.model_construct()
        error_messages = []
        match = 0

        # deserialize data into AgentsExecutionExtApiCallCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionExtApiCallCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScratchpadReadCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScratchpadReadCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScratchpadWriteCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScratchpadWriteCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptPlaywrightCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptPlaywrightCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptHybridPlaywrightCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptHybridPlaywrightCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionBrowserRunCodeCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionBrowserRunCodeCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptEvalCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptEvalCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionFileReadCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionFileReadCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionFileListCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionFileListCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionFileStageCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionFileStageCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionElementFileUploadCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionElementFileUploadCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionExtGetMailCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionExtGetMailCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptPadRunFunctionCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptPadRunFunctionCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptpadReadCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptpadReadCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptpadWriteCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptpadWriteCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionScriptpadSearchReplaceCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionScriptpadSearchReplaceCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionObsSnapshotWithSelectorsCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionObsSnapshotWithSelectorsCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionUtilGetDatetimeCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionUtilGetDatetimeCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionNavToCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionNavToCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into AgentsExecutionAgentQueryContextCompletedDetails
        try:
            instance.actual_instance = AgentsExecutionAgentQueryContextCompletedDetails.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))

        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when deserializing the JSON string into AgentsExecutionActivityActionCompletedInfo with oneOf schemas: AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when deserializing the JSON string into AgentsExecutionActivityActionCompletedInfo with oneOf schemas: AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails. Details: " + ", ".join(error_messages))
        else:
            return instance

    def to_json(self) -> str:
        """Returns the JSON representation of the actual instance"""
        if self.actual_instance is None:
            return "null"

        if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
            return self.actual_instance.to_json()
        else:
            return json.dumps(self.actual_instance)

    def to_dict(self) -> Optional[Union[Dict[str, Any], AgentsExecutionAgentQueryContextCompletedDetails, AgentsExecutionBrowserRunCodeCompletedDetails, AgentsExecutionElementFileUploadCompletedDetails, AgentsExecutionExtApiCallCompletedDetails, AgentsExecutionExtGetMailCompletedDetails, AgentsExecutionFileListCompletedDetails, AgentsExecutionFileReadCompletedDetails, AgentsExecutionFileStageCompletedDetails, AgentsExecutionNavToCompletedDetails, AgentsExecutionObsSnapshotWithSelectorsCompletedDetails, AgentsExecutionScratchpadReadCompletedDetails, AgentsExecutionScratchpadWriteCompletedDetails, AgentsExecutionScriptEvalCompletedDetails, AgentsExecutionScriptHybridPlaywrightCompletedDetails, AgentsExecutionScriptPadRunFunctionCompletedDetails, AgentsExecutionScriptPlaywrightCompletedDetails, AgentsExecutionScriptpadReadCompletedDetails, AgentsExecutionScriptpadSearchReplaceCompletedDetails, AgentsExecutionScriptpadWriteCompletedDetails, AgentsExecutionUtilGetDatetimeCompletedDetails]]:
        """Returns the dict representation of the actual instance"""
        if self.actual_instance is None:
            return None

        if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
            return self.actual_instance.to_dict()
        else:
            # primitive type
            return self.actual_instance

    def to_str(self) -> str:
        """Returns the string representation of the actual instance"""
        return pprint.pformat(self.model_dump())


