# coding: utf-8

"""
    CryptoAPIs

    Crypto APIs is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of their blockchain applications. Crypto APIs provides unified endpoints and data, raw data, automatic tokens and coins forwardings, callback functionalities, and much more.  # noqa: E501

    The version of the OpenAPI document: 2021-03-20
    Contact: developers@cryptoapis.io
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr

class DecodeRawTransactionHexRISE(BaseModel):
    """
    Ethereum
    """
    approximate_fee: Optional[StrictStr] = Field(None, alias="approximateFee", description="Defines the approximate fee value. When isConfirmed is True - Defines the amount of the transaction fee When isConfirmed is False - For ETH-based blockchains this attribute represents the max fee value.")
    approximate_minimum_required_fee: Optional[StrictStr] = Field(None, alias="approximateMinimumRequiredFee", description="Defines the approximate minimum fee that is required for the transaction.")
    gas_limit: StrictStr = Field(..., alias="gasLimit", description="Represents the amount of gas used by this specific transaction alone.")
    gas_paid_for_data: Optional[StrictStr] = Field(None, alias="gasPaidForData", description="Represents the amount of gas paid for the data in the transaction.")
    gas_price: Optional[StrictStr] = Field(None, alias="gasPrice", description="Represents the price offered to the miner to purchase this amount of gas.")
    input_data: Optional[StrictStr] = Field(None, alias="inputData", description="Represents additional information that is required for the transaction.")
    max_fee_per_gas: Optional[StrictStr] = Field(None, alias="maxFeePerGas", description="Defines the maximum amount that customer is willing to pay per unit of gas to get his transaction included in a block.")
    max_fee_priority_per_gas: Optional[StrictStr] = Field(None, alias="maxFeePriorityPerGas", description="Represents determined by the user value that is paid directly to miners.")
    nonce: StrictInt = Field(..., description="Represents the sequential running number for an address, starting from 0 for the first transaction. E.g., if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address.")
    r: Optional[StrictStr] = Field(None, description="Represents output of an ECDSA signature.")
    recipient: StrictStr = Field(..., description="The address which receives this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one recipient.")
    s: Optional[StrictStr] = Field(None, description="Represents output of an ECDSA signature.")
    sender: StrictStr = Field(..., description="Represents the address which sends this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one sender.")
    type: StrictInt = Field(..., description="Specifies the transaction type as one from three options: if response returns a `\"0\"` it means the raw transaction includes legacy transaction data, if it is `\"1\"` - includes access lists for EIP2930, and if it is `\"2\"` - EIP1559 data.")
    v: Optional[StrictStr] = Field(None, description="Defines the the recovery id.")
    value: Optional[StrictStr] = Field(None, description="Represents the sent/received amount.")
    __properties = ["approximateFee", "approximateMinimumRequiredFee", "gasLimit", "gasPaidForData", "gasPrice", "inputData", "maxFeePerGas", "maxFeePriorityPerGas", "nonce", "r", "recipient", "s", "sender", "type", "v", "value"]

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

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

        _obj = DecodeRawTransactionHexRISE.parse_obj({
            "approximate_fee": obj.get("approximateFee"),
            "approximate_minimum_required_fee": obj.get("approximateMinimumRequiredFee"),
            "gas_limit": obj.get("gasLimit"),
            "gas_paid_for_data": obj.get("gasPaidForData"),
            "gas_price": obj.get("gasPrice"),
            "input_data": obj.get("inputData"),
            "max_fee_per_gas": obj.get("maxFeePerGas"),
            "max_fee_priority_per_gas": obj.get("maxFeePriorityPerGas"),
            "nonce": obj.get("nonce"),
            "r": obj.get("r"),
            "recipient": obj.get("recipient"),
            "s": obj.get("s"),
            "sender": obj.get("sender"),
            "type": obj.get("type"),
            "v": obj.get("v"),
            "value": obj.get("value")
        })
        return _obj

