# coding: utf-8

"""
    Mentortools Chat API

    Mentortools service for chatting

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


from typing import Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt

class MtBreakdown(BaseModel):
    """
    Per-category MT-credit split for a single log row.  Derived by applying portal-plan weights to per-category USD and scaling so the sum equals the canonical `mt_credits`. When the portal's current weights match those at billing time, this reconstructs the upstream math exactly. When weights have drifted since, the sum still matches `mt_credits` but per-category values shift proportionally to the current weighted distribution.  # noqa: E501
    """
    text: Optional[Union[StrictFloat, StrictInt]] = 0.0
    voice: Optional[Union[StrictFloat, StrictInt]] = 0.0
    image: Optional[Union[StrictFloat, StrictInt]] = 0.0
    video: Optional[Union[StrictFloat, StrictInt]] = 0.0
    audio: Optional[Union[StrictFloat, StrictInt]] = 0.0
    __properties = ["text", "voice", "image", "video", "audio"]

    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) -> MtBreakdown:
        """Create an instance of MtBreakdown 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) -> MtBreakdown:
        """Create an instance of MtBreakdown from a dict"""
        if obj is None:
            return None

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

        _obj = MtBreakdown.parse_obj({
            "text": obj.get("text") if obj.get("text") is not None else 0.0,
            "voice": obj.get("voice") if obj.get("voice") is not None else 0.0,
            "image": obj.get("image") if obj.get("image") is not None else 0.0,
            "video": obj.get("video") if obj.get("video") is not None else 0.0,
            "audio": obj.get("audio") if obj.get("audio") is not None else 0.0
        })
        return _obj


