data_channel_earn.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "data/data_statistics_chart.h"
  9. #include <QtCore/QDateTime>
  10. namespace Data {
  11. using EarnInt = uint64;
  12. constexpr auto kEarnMultiplier = EarnInt(1000000000);
  13. struct EarnHistoryEntry final {
  14. enum class Type {
  15. In,
  16. Out,
  17. Return,
  18. };
  19. enum class Status {
  20. Success,
  21. Failed,
  22. Pending,
  23. };
  24. Type type;
  25. Status status;
  26. EarnInt amount = 0;
  27. QDateTime date;
  28. QDateTime dateTo;
  29. QString provider;
  30. QDateTime successDate;
  31. QString successLink;
  32. };
  33. struct EarnHistorySlice final {
  34. using OffsetToken = int;
  35. std::vector<EarnHistoryEntry> list;
  36. int total = 0;
  37. bool allLoaded = false;
  38. OffsetToken token;
  39. };
  40. struct EarnStatistics final {
  41. explicit operator bool() const {
  42. return !!usdRate;
  43. }
  44. Data::StatisticalGraph topHoursGraph;
  45. Data::StatisticalGraph revenueGraph;
  46. EarnInt currentBalance = 0;
  47. EarnInt availableBalance = 0;
  48. EarnInt overallRevenue = 0;
  49. float64 usdRate = 0.;
  50. bool switchedOff = false;
  51. EarnHistorySlice firstHistorySlice;
  52. };
  53. } // namespace Data