aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/ReferralProgramSortOrder.cpp
blob: f7b8b398c79164363b21329e8115fd9edf09d74a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/ReferralProgramSortOrder.h"

namespace td {

ReferralProgramSortOrder get_referral_program_sort_order(
    const td_api::object_ptr<td_api::AffiliateProgramSortOrder> &order) {
  if (order == nullptr) {
    return ReferralProgramSortOrder::Profitability;
  }
  switch (order->get_id()) {
    case td_api::affiliateProgramSortOrderProfitability::ID:
      return ReferralProgramSortOrder::Profitability;
    case td_api::affiliateProgramSortOrderCreationDate::ID:
      return ReferralProgramSortOrder::Date;
    case td_api::affiliateProgramSortOrderRevenue::ID:
      return ReferralProgramSortOrder::Revenue;
    default:
      UNREACHABLE();
      return ReferralProgramSortOrder::Profitability;
  }
}

}  // namespace td