# coding: utf-8

"""
    FastAPI

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

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

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


from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Dict, Optional, Union

from pydantic.v1 import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr


class LegacyImageGenerationRequest(BaseModel):
    """
    Model input data type.  # noqa: E501
    """

    prompt: StrictStr = Field(...)
    prompt_2: Optional[StrictStr] = None
    negative_prompt: Optional[StrictStr] = None
    negative_prompt_2: Optional[StrictStr] = None
    model: Optional[StrictStr] = None
    loras: Optional[Dict[str, Union[StrictFloat, StrictInt]]] = None
    sampler: Optional[StrictStr] = "DDIM"
    height: Optional[StrictInt] = 1024
    width: Optional[StrictInt] = 1024
    cfg_scale: Optional[Union[StrictFloat, StrictInt]] = 12.0
    steps: Optional[StrictInt] = 30
    num_images: Optional[StrictInt] = 1
    seed: Optional[StrictInt] = None
    init_image: Optional[StrictStr] = None
    strength: Optional[Union[StrictFloat, StrictInt]] = 0.8
    style_preset: Optional[StrictStr] = None
    use_refiner: Optional[StrictBool] = True
    high_noise_frac: Optional[Union[StrictFloat, StrictInt]] = 0.8
    enable_safety: Optional[StrictBool] = False
    output_type: Optional[StrictStr] = "jpg"
    __properties = [
        "prompt",
        "prompt_2",
        "negative_prompt",
        "negative_prompt_2",
        "model",
        "loras",
        "sampler",
        "height",
        "width",
        "cfg_scale",
        "steps",
        "num_images",
        "seed",
        "init_image",
        "strength",
        "style_preset",
        "use_refiner",
        "high_noise_frac",
        "enable_safety",
        "output_type",
    ]

    class Config:
        """Pydantic configuration"""

        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> LegacyImageGenerationRequest:
        """Create an instance of LegacyImageGenerationRequest from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return LegacyImageGenerationRequest.parse_obj(obj)

        _obj = LegacyImageGenerationRequest.parse_obj(
            {
                "prompt": obj.get("prompt"),
                "prompt_2": obj.get("prompt_2"),
                "negative_prompt": obj.get("negative_prompt"),
                "negative_prompt_2": obj.get("negative_prompt_2"),
                "model": obj.get("model"),
                "loras": obj.get("loras"),
                "sampler": obj.get("sampler")
                if obj.get("sampler") is not None
                else "DDIM",
                "height": obj.get("height") if obj.get("height") is not None else 1024,
                "width": obj.get("width") if obj.get("width") is not None else 1024,
                "cfg_scale": obj.get("cfg_scale")
                if obj.get("cfg_scale") is not None
                else 12.0,
                "steps": obj.get("steps") if obj.get("steps") is not None else 30,
                "num_images": obj.get("num_images")
                if obj.get("num_images") is not None
                else 1,
                "seed": obj.get("seed"),
                "init_image": obj.get("init_image"),
                "strength": obj.get("strength")
                if obj.get("strength") is not None
                else 0.8,
                "style_preset": obj.get("style_preset"),
                "use_refiner": obj.get("use_refiner")
                if obj.get("use_refiner") is not None
                else True,
                "high_noise_frac": obj.get("high_noise_frac")
                if obj.get("high_noise_frac") is not None
                else 0.8,
                "enable_safety": obj.get("enable_safety")
                if obj.get("enable_safety") is not None
                else False,
                "output_type": obj.get("output_type")
                if obj.get("output_type") is not None
                else "jpg",
            }
        )
        return _obj
