1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_COMMON_TYPES_H
17 #define OHOS_COMMON_TYPES_H
18 #include <map>
19 #include <string>
20 #include <variant>
21 #include <vector>
22 namespace OHOS::CommonType {
23 struct AssetValue {
24     enum Status : int32_t {
25         STATUS_UNKNOWN,
26         STATUS_NORMAL,
27         STATUS_INSERT,
28         STATUS_UPDATE,
29         STATUS_DELETE,
30         STATUS_ABNORMAL,
31         STATUS_DOWNLOADING,
32         STATUS_BUTT
33     };
34     static constexpr uint64_t NO_EXPIRES_TIME = 0;
35     uint32_t version = 0;
36     mutable uint32_t status = STATUS_UNKNOWN;
37     uint64_t expiresTime = NO_EXPIRES_TIME;
38     std::string id;
39     std::string name;
40     std::string uri;
41     std::string createTime;
42     std::string modifyTime;
43     std::string size;
44     std::string hash;
45     std::string path;
46 };
47 using Bytes = std::vector<uint8_t>;
48 using Asset = AssetValue;
49 using Assets = std::vector<AssetValue>;
50 using Value = std::variant<std::monostate, int64_t, double, std::string, bool, Bytes, Asset, Assets>;
51 using ValuesBucket = std::map<std::string, Value>;
52 }
53 #endif // OHOS_COMMON_TYPES_H
54