# coding: utf-8

"""
    Klaviyo API

    The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.

    Contact: developers@klaviyo.com
    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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.text_style import TextStyle
from typing import Optional, Set
from typing_extensions import Self

class InputStyles(BaseModel):
    """
    InputStyles
    """ # noqa: E501
    text_styles: Optional[TextStyle] = None
    label_color: Optional[StrictStr] = '#303B43'
    text_color: Optional[StrictStr] = '#000000'
    placeholder_color: Optional[StrictStr] = '#949596'
    background_color: Optional[StrictStr] = '#FFFFFF'
    border_color: Optional[StrictStr] = '#949596'
    border_focus_color: Optional[StrictStr] = '#000000'
    focus_outline_color: Optional[StrictStr] = '#1C65AD'
    corner_radius: Optional[StrictInt] = 2
    field_height: Optional[StrictInt] = 38
    __properties: ClassVar[List[str]] = ["text_styles", "label_color", "text_color", "placeholder_color", "background_color", "border_color", "border_focus_color", "focus_outline_color", "corner_radius", "field_height"]

    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 InputStyles 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 text_styles
        if self.text_styles:
            _dict['text_styles'] = self.text_styles.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "text_styles": TextStyle.from_dict(obj["text_styles"]) if obj.get("text_styles") is not None else None,
            "label_color": obj.get("label_color") if obj.get("label_color") is not None else '#303B43',
            "text_color": obj.get("text_color") if obj.get("text_color") is not None else '#000000',
            "placeholder_color": obj.get("placeholder_color") if obj.get("placeholder_color") is not None else '#949596',
            "background_color": obj.get("background_color") if obj.get("background_color") is not None else '#FFFFFF',
            "border_color": obj.get("border_color") if obj.get("border_color") is not None else '#949596',
            "border_focus_color": obj.get("border_focus_color") if obj.get("border_focus_color") is not None else '#000000',
            "focus_outline_color": obj.get("focus_outline_color") if obj.get("focus_outline_color") is not None else '#1C65AD',
            "corner_radius": obj.get("corner_radius") if obj.get("corner_radius") is not None else 2,
            "field_height": obj.get("field_height") if obj.get("field_height") is not None else 38
        })
        return _obj


