# 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 pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from asteroid_odyssey.models.agents_files_temp_file import AgentsFilesTempFile
from typing import Optional, Set
from typing_extensions import Self

class AgentsWorkflowExecuteWorkflowRequest(BaseModel):
    """
    Request to execute a workflow by ID
    """ # noqa: E501
    input_variables: Optional[Dict[str, Any]] = Field(default=None, description="Input variables to be merged into the placeholders defined in prompts", alias="inputVariables")
    metadata: Optional[Dict[str, Any]] = Field(default=None, description="Optional metadata key-value pairs for organizing and filtering executions")
    agent_profile_id: Optional[StrictStr] = Field(default=None, description="The ID of the agent profile to use. Note this is not the agent ID", alias="agentProfileId")
    agent_profile_pool_id: Optional[StrictStr] = Field(default=None, description="The ID of the agent profile pool to select a profile from. Mutually exclusive with agentProfileId.", alias="agentProfilePoolId")
    temp_files: Optional[List[AgentsFilesTempFile]] = Field(default=None, description="Array of temporary files to attach to the execution. Must have been pre-uploaded using the stage file endpoint", alias="tempFiles")
    __properties: ClassVar[List[str]] = ["inputVariables", "metadata", "agentProfileId", "agentProfilePoolId", "tempFiles"]

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


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of AgentsWorkflowExecuteWorkflowRequest from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in temp_files (list)
        _items = []
        if self.temp_files:
            for _item_temp_files in self.temp_files:
                if _item_temp_files:
                    _items.append(_item_temp_files.to_dict())
            _dict['tempFiles'] = _items
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of AgentsWorkflowExecuteWorkflowRequest from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "inputVariables": obj.get("inputVariables"),
            "metadata": obj.get("metadata"),
            "agentProfileId": obj.get("agentProfileId"),
            "agentProfilePoolId": obj.get("agentProfilePoolId"),
            "tempFiles": [AgentsFilesTempFile.from_dict(_item) for _item in obj["tempFiles"]] if obj.get("tempFiles") is not None else None
        })
        return _obj


