# coding: utf-8

"""
    FlowHunt

    FlowHunt API

    The version of the OpenAPI document: 2.0.0
    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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from flowhunt.models.aspec_ratio import AspecRatio
from flowhunt.models.base_foundation_model import BaseFoundationModel
from typing import Optional, Set
from typing_extensions import Self

class ImageInferenceRequest(BaseModel):
    """
    ImageInferenceRequest
    """ # noqa: E501
    base_model: BaseFoundationModel = Field(description="The base model to use for inference")
    prompt: StrictStr = Field(description="The prompt to use for inference")
    image_fts: List[StrictStr] = Field(description="The list of image FTs to use for inference")
    number_of_outputs: Optional[StrictInt] = Field(default=1, description="The number of outputs to generate")
    aspect_ratio: Optional[AspecRatio] = Field(default=None, description="The aspect ratio of the output images")
    steps: Optional[StrictInt] = None
    guidance_scale: Optional[Union[Annotated[float, Field(le=10.0, strict=True, ge=0.0)], Annotated[int, Field(le=10, strict=True, ge=0)]]] = None
    styles: Optional[List[StrictStr]] = None
    effects: Optional[List[StrictStr]] = None
    use_ai_agent: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = ["base_model", "prompt", "image_fts", "number_of_outputs", "aspect_ratio", "steps", "guidance_scale", "styles", "effects", "use_ai_agent"]

    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 ImageInferenceRequest 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,
        )
        # set to None if steps (nullable) is None
        # and model_fields_set contains the field
        if self.steps is None and "steps" in self.model_fields_set:
            _dict['steps'] = None

        # set to None if guidance_scale (nullable) is None
        # and model_fields_set contains the field
        if self.guidance_scale is None and "guidance_scale" in self.model_fields_set:
            _dict['guidance_scale'] = None

        # set to None if styles (nullable) is None
        # and model_fields_set contains the field
        if self.styles is None and "styles" in self.model_fields_set:
            _dict['styles'] = None

        # set to None if effects (nullable) is None
        # and model_fields_set contains the field
        if self.effects is None and "effects" in self.model_fields_set:
            _dict['effects'] = None

        # set to None if use_ai_agent (nullable) is None
        # and model_fields_set contains the field
        if self.use_ai_agent is None and "use_ai_agent" in self.model_fields_set:
            _dict['use_ai_agent'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "base_model": obj.get("base_model"),
            "prompt": obj.get("prompt"),
            "image_fts": obj.get("image_fts"),
            "number_of_outputs": obj.get("number_of_outputs") if obj.get("number_of_outputs") is not None else 1,
            "aspect_ratio": obj.get("aspect_ratio"),
            "steps": obj.get("steps"),
            "guidance_scale": obj.get("guidance_scale"),
            "styles": obj.get("styles"),
            "effects": obj.get("effects"),
            "use_ai_agent": obj.get("use_ai_agent")
        })
        return _obj


