# coding: utf-8

"""
    用户全部 API 文档

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

    The version of the OpenAPI document: v1
    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class IntactChargeInfo(BaseModel):
    """
    IntactChargeInfo
    """ # noqa: E501
    actual_amount: Optional[StrictStr] = Field(default=None, alias="actualAmount")
    bill_type: Optional[StrictStr] = Field(default=None, alias="billType")
    gmt_pay: Optional[StrictStr] = Field(default=None, alias="gmtPay")
    is_refund: Optional[StrictBool] = Field(default=None, alias="isRefund")
    out_biz_no: Optional[StrictStr] = Field(default=None, alias="outBizNo")
    plan_amount: Optional[StrictStr] = Field(default=None, alias="planAmount")
    product_name: Optional[StrictStr] = Field(default=None, alias="productName")
    service_target: Optional[StrictStr] = Field(default=None, alias="serviceTarget")
    service_type: Optional[StrictStr] = Field(default=None, alias="serviceType")
    status: Optional[StrictStr] = None
    target_account_no: Optional[StrictStr] = Field(default=None, alias="targetAccountNo")
    target_user_id: Optional[StrictStr] = Field(default=None, alias="targetUserId")
    __properties: ClassVar[List[str]] = ["actualAmount", "billType", "gmtPay", "isRefund", "outBizNo", "planAmount", "productName", "serviceTarget", "serviceType", "status", "targetAccountNo", "targetUserId"]

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "actualAmount": obj.get("actualAmount"),
            "billType": obj.get("billType"),
            "gmtPay": obj.get("gmtPay"),
            "isRefund": obj.get("isRefund"),
            "outBizNo": obj.get("outBizNo"),
            "planAmount": obj.get("planAmount"),
            "productName": obj.get("productName"),
            "serviceTarget": obj.get("serviceTarget"),
            "serviceType": obj.get("serviceType"),
            "status": obj.get("status"),
            "targetAccountNo": obj.get("targetAccountNo"),
            "targetUserId": obj.get("targetUserId")
        })
        return _obj


