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 OS_ACCOUNT_INTERFACES_INNERKITS_OHOSACCOUNT_NATIVE_INCLUDE_DISTRIBUTED_ACCOUNT_SUBSCRIBE_CALLBACK_H
17 #define OS_ACCOUNT_INTERFACES_INNERKITS_OHOSACCOUNT_NATIVE_INCLUDE_DISTRIBUTED_ACCOUNT_SUBSCRIBE_CALLBACK_H
18 
19 #include "account_error_no.h"
20 #include "parcel.h"
21 
22 namespace OHOS {
23 namespace AccountSA {
24 enum class DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE : int32_t {
25     LOGIN = 0,
26     LOGOUT,
27     LOGOFF,
28     TOKEN_INVALID,
29 };
30 
31 class DistributedAccountEventData : public Parcelable {
32 public:
33     int32_t id_;
34     DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type_;
35 
36     bool Marshalling(Parcel &parcel) const override;
37     static DistributedAccountEventData *Unmarshalling(Parcel &parcel);
38     bool operator==(const DistributedAccountEventData &eventData) const;
39 
40 private:
41     bool ReadFromParcel(Parcel &parcel);
42 };
43 
44 class DistributedAccountSubscribeCallback {
45 public:
46     virtual void OnAccountsChanged(const DistributedAccountEventData &eventData) = 0;
47 };
48 }  // namespace AccountSA
49 }  // namespace OHOS
50 
51 #endif  // OS_ACCOUNT_INTERFACES_INNERKITS_OHOSACCOUNT_NATIVE_INCLUDE_DISTRIBUTED_ACCOUNT_SUBSCRIBE_CALLBACK_H
52