1 //
2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 #pragma once
8 
9 #include "td/telegram/td_api.h"
10 
11 #include "td/utils/common.h"
12 #include "td/utils/Slice.h"
13 #include "td/utils/StringBuilder.h"
14 
15 namespace td {
16 
17 enum class FileType : int32 {
18   Thumbnail,
19   ProfilePhoto,
20   Photo,
21   VoiceNote,
22   Video,
23   Document,
24   Encrypted,
25   Temp,
26   Sticker,
27   Audio,
28   Animation,
29   EncryptedThumbnail,
30   Wallpaper,
31   VideoNote,
32   SecureRaw,
33   Secure,
34   Background,
35   DocumentAsFile,
36   Size,
37   None
38 };
39 
40 enum class FileDirType : int8 { Secure, Common };
41 
42 constexpr int32 MAX_FILE_TYPE = static_cast<int32>(FileType::Size);
43 
44 FileType get_file_type(const td_api::FileType &file_type);
45 
46 tl_object_ptr<td_api::FileType> get_file_type_object(FileType file_type);
47 
48 FileType get_main_file_type(FileType file_type);
49 
50 CSlice get_file_type_name(FileType file_type);
51 
52 StringBuilder &operator<<(StringBuilder &string_builder, FileType file_type);
53 
54 FileDirType get_file_dir_type(FileType file_type);
55 
56 bool is_file_big(FileType file_type, int64 expected_size);
57 
58 }  // namespace td
59