1 /*
2  * Copyright (c) 2024 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_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_METADATA_SWITCHES_META_DATA_H
17 #define OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_METADATA_SWITCHES_META_DATA_H
18 
19 #include <string>
20 #include "serializable/serializable.h"
21 
22 namespace OHOS::DistributedData {
23 class API_EXPORT SwitchesMetaData final : public Serializable {
24 public:
25     static constexpr uint32_t DEFAULT_VERSION = 0;
26     static constexpr uint32_t INVALID_VALUE = 0xFFFFFFFF;
27     static constexpr uint16_t INVALID_LENGTH = 0;
28     uint32_t version = DEFAULT_VERSION;
29     uint32_t value = INVALID_VALUE;
30     uint16_t length = INVALID_LENGTH;
31     std::string deviceId;
32 
33     bool Marshal(json &node) const override;
34     bool Unmarshal(const json &node) override;
35     std::string GetKey() const;
36     API_EXPORT bool operator==(const SwitchesMetaData &meta) const;
37     API_EXPORT bool operator!=(const SwitchesMetaData &meta) const;
38     API_EXPORT static std::string GetPrefix(const std::initializer_list<std::string> &fields);
39 
40 private:
41     static constexpr const char *KEY_PREFIX = "SwitchesMeta";
42 };
43 } // namespace OHOS::DistributedData
44 
45 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_METADATA_SWITCHES_META_DATA_H
46