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_RELATIONAL_STORE_INNER_API_ASSET_VALUE_H
17 #define OHOS_RELATIONAL_STORE_INNER_API_ASSET_VALUE_H
18 #include <string>
19 namespace OHOS::NativeRdb {
20 struct AssetValue {
21     enum Status : int32_t {
22         STATUS_UNKNOWN,
23         STATUS_NORMAL,
24         STATUS_INSERT,
25         STATUS_UPDATE,
26         STATUS_DELETE,
27         STATUS_ABNORMAL,
28         STATUS_DOWNLOADING,
29         STATUS_BUTT
30     };
31     static constexpr uint64_t NO_EXPIRES_TIME = 0;
32     uint32_t version = 0;
33     mutable uint32_t status = STATUS_UNKNOWN;
34     uint64_t expiresTime = NO_EXPIRES_TIME;
35     std::string id;
36     std::string name;
37     std::string uri;
38     std::string createTime;
39     std::string modifyTime;
40     std::string size;
41     std::string hash;
42     std::string path;
43 
44     bool operator<(const AssetValue &ref) const
45     {
46         if (name != ref.name) {
47             return name < ref.name;
48         }
49         if (status != ref.status) {
50             return status < ref.status;
51         }
52         if (id != ref.id) {
53             return id < ref.id;
54         }
55         if (uri != ref.uri) {
56             return uri < ref.uri;
57         }
58         if (createTime != ref.createTime) {
59             return createTime < ref.createTime;
60         }
61         if (modifyTime != ref.modifyTime) {
62             return modifyTime < ref.modifyTime;
63         }
64         if (size != ref.size) {
65             return size < ref.size;
66         }
67         if (hash != ref.hash) {
68             return hash < ref.hash;
69         }
70         return path < ref.path;
71     }
72 };
73 }
74 #endif // OHOS_RELATIONAL_STORE_INNER_API_ASSET_VALUE_H
75