# coding: utf-8

"""
    CampaignManagementService

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

    The version of the OpenAPI document: 1.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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from typing_extensions import Self

class RecommendationCropSetting(BaseModel):
    """
    RecommendationCropSetting
    """ # noqa: E501
    source_x: Optional[StrictInt] = Field(default=None, alias="sourceX")
    source_y: Optional[StrictInt] = Field(default=None, alias="sourceY")
    source_width: Optional[StrictInt] = Field(default=None, alias="sourceWidth")
    source_height: Optional[StrictInt] = Field(default=None, alias="sourceHeight")
    aspect_ratio: Optional[StrictStr] = Field(default=None, alias="aspectRatio")
    __properties: ClassVar[List[str]] = ["sourceX", "sourceY", "sourceWidth", "sourceHeight", "aspectRatio"]

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "sourceX": obj.get("SourceX") if obj.get("SourceX") is not None else None,
                        "sourceY": obj.get("SourceY") if obj.get("SourceY") is not None else None,
                        "sourceWidth": obj.get("SourceWidth") if obj.get("SourceWidth") is not None else None,
                        "sourceHeight": obj.get("SourceHeight") if obj.get("SourceHeight") is not None else None,
                        "aspectRatio": obj.get("AspectRatio") if obj.get("AspectRatio") is not None else None
        })
        return _obj
