#  FORK PYROFORK <http://www.gnu.org/licenses/>.

from io import BytesIO

from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrogram.raw.core import TLObject
from pyrogram import raw
from typing import List, Optional, Any

# # # # # # # # # # # # # # # # # # # # # # # #
#               !!! WARNING !!!               #
#          This is a generated file!          #
# All changes made in this file will be lost! #
# # # # # # # # # # # # # # # # # # # # # # # #


class BroadcastRevenueStats(TLObject):  # type: ignore
    """Telegram API type.

    Constructor of :obj:`~pyrogram.raw.base.stats.BroadcastRevenueStats`.

    Details:
        - Layer: ``177``
        - ID: ``D07B4BAD``

    Parameters:
        top_hours_graph (:obj:`StatsGraph <pyrogram.raw.base.StatsGraph>`):
            N/A

        revenue_graph (:obj:`StatsGraph <pyrogram.raw.base.StatsGraph>`):
            N/A

        current_balance (``int`` ``64-bit``):
            N/A

        available_balance (``int`` ``64-bit``):
            N/A

        overall_revenue (``int`` ``64-bit``):
            N/A

        usd_rate (``float`` ``64-bit``):
            N/A

    Functions:
        This object can be returned by 1 function.

        .. currentmodule:: pyrogram.raw.functions

        .. autosummary::
            :nosignatures:

            stats.GetBroadcastRevenueStats
    """

    __slots__: List[str] = ["top_hours_graph", "revenue_graph", "current_balance", "available_balance", "overall_revenue", "usd_rate"]

    ID = 0xd07b4bad
    QUALNAME = "types.stats.BroadcastRevenueStats"

    def __init__(self, *, top_hours_graph: "raw.base.StatsGraph", revenue_graph: "raw.base.StatsGraph", current_balance: int, available_balance: int, overall_revenue: int, usd_rate: float) -> None:
        self.top_hours_graph = top_hours_graph  # StatsGraph
        self.revenue_graph = revenue_graph  # StatsGraph
        self.current_balance = current_balance  # long
        self.available_balance = available_balance  # long
        self.overall_revenue = overall_revenue  # long
        self.usd_rate = usd_rate  # double

    @staticmethod
    def read(b: BytesIO, *args: Any) -> "BroadcastRevenueStats":
        # No flags
        
        top_hours_graph = TLObject.read(b)
        
        revenue_graph = TLObject.read(b)
        
        current_balance = Long.read(b)
        
        available_balance = Long.read(b)
        
        overall_revenue = Long.read(b)
        
        usd_rate = Double.read(b)
        
        return BroadcastRevenueStats(top_hours_graph=top_hours_graph, revenue_graph=revenue_graph, current_balance=current_balance, available_balance=available_balance, overall_revenue=overall_revenue, usd_rate=usd_rate)

    def write(self, *args) -> bytes:
        b = BytesIO()
        b.write(Int(self.ID, False))

        # No flags
        
        b.write(self.top_hours_graph.write())
        
        b.write(self.revenue_graph.write())
        
        b.write(Long(self.current_balance))
        
        b.write(Long(self.available_balance))
        
        b.write(Long(self.overall_revenue))
        
        b.write(Double(self.usd_rate))
        
        return b.getvalue()
