1c2b37d2cSopenharmony_ci/*
2c2b37d2cSopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3c2b37d2cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c2b37d2cSopenharmony_ci * you may not use this file except in compliance with the License.
5c2b37d2cSopenharmony_ci * You may obtain a copy of the License at
6c2b37d2cSopenharmony_ci *
7c2b37d2cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c2b37d2cSopenharmony_ci *
9c2b37d2cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c2b37d2cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c2b37d2cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c2b37d2cSopenharmony_ci * See the License for the specific language governing permissions and
13c2b37d2cSopenharmony_ci * limitations under the License.
14c2b37d2cSopenharmony_ci */
15c2b37d2cSopenharmony_ci
16c2b37d2cSopenharmony_ci#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
17c2b37d2cSopenharmony_ci#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
18c2b37d2cSopenharmony_ci
19c2b37d2cSopenharmony_ci#include "iaccount.h"
20c2b37d2cSopenharmony_ci#include "iaccount_context.h"
21c2b37d2cSopenharmony_ci#include <iremote_broker.h>
22c2b37d2cSopenharmony_ci#include <iremote_object.h>
23c2b37d2cSopenharmony_ci#include <iremote_stub.h>
24c2b37d2cSopenharmony_ci#include <map>
25c2b37d2cSopenharmony_ci
26c2b37d2cSopenharmony_cinamespace OHOS {
27c2b37d2cSopenharmony_cinamespace AccountSA {
28c2b37d2cSopenharmony_ciclass AccountStub;
29c2b37d2cSopenharmony_ciusing AccountStubFunc = std::function<std::int32_t(MessageParcel &data, MessageParcel &reply)>;
30c2b37d2cSopenharmony_ciclass AccountStub : public IRemoteStub<IAccount>, public IAccountContext {
31c2b37d2cSopenharmony_cipublic:
32c2b37d2cSopenharmony_ci    AccountStub();
33c2b37d2cSopenharmony_ci    virtual std::int32_t OnRemoteRequest(
34c2b37d2cSopenharmony_ci        std::uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35c2b37d2cSopenharmony_ci
36c2b37d2cSopenharmony_cipublic:
37c2b37d2cSopenharmony_ci    std::int32_t InnerUpdateOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
38c2b37d2cSopenharmony_ci    std::int32_t CmdUpdateOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
39c2b37d2cSopenharmony_ci    std::int32_t InnerSetOhosAccountInfo(int32_t userId, MessageParcel &data, MessageParcel &reply);
40c2b37d2cSopenharmony_ci    std::int32_t CmdSetOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
41c2b37d2cSopenharmony_ci    std::int32_t CmdSetOhosAccountInfoByUserId(MessageParcel &data, MessageParcel &reply);
42c2b37d2cSopenharmony_ci
43c2b37d2cSopenharmony_ci    std::int32_t InnerGetOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
44c2b37d2cSopenharmony_ci    std::int32_t CmdGetOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
45c2b37d2cSopenharmony_ci    std::int32_t CmdGetOhosAccountInfoByUserId(MessageParcel &data, MessageParcel &reply);
46c2b37d2cSopenharmony_ci    std::int32_t InnerQueryOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
47c2b37d2cSopenharmony_ci    std::int32_t CmdQueryOhosAccountInfo(MessageParcel &data, MessageParcel &reply);
48c2b37d2cSopenharmony_ci
49c2b37d2cSopenharmony_ci    std::int32_t CmdQueryOhosAccountInfoByUserId(MessageParcel &data, MessageParcel &reply);
50c2b37d2cSopenharmony_ci    std::int32_t CmdQueryDeviceAccountId(MessageParcel &data, MessageParcel &reply);
51c2b37d2cSopenharmony_ci
52c2b37d2cSopenharmony_ci    std::int32_t CmdSubscribeDistributedAccountEvent(MessageParcel &data, MessageParcel &reply);
53c2b37d2cSopenharmony_ci    std::int32_t CmdUnsubscribeDistributedAccountEvent(MessageParcel &data, MessageParcel &reply);
54c2b37d2cSopenharmony_ci
55c2b37d2cSopenharmony_ci    std::int32_t CmdGetAppAccountService(MessageParcel &data, MessageParcel &reply);
56c2b37d2cSopenharmony_ci    std::int32_t CmdGetOsAccountService(MessageParcel &data, MessageParcel &reply);
57c2b37d2cSopenharmony_ci    std::int32_t CmdGetAccountIAMService(MessageParcel &data, MessageParcel &reply);
58c2b37d2cSopenharmony_ci    std::int32_t CmdGetDomainAccountService(MessageParcel &data, MessageParcel &reply);
59c2b37d2cSopenharmony_ci    bool HasAccountRequestPermission(const std::string &permissionName);
60c2b37d2cSopenharmony_ci
61c2b37d2cSopenharmony_ciprivate:
62c2b37d2cSopenharmony_ci    std::map<AccountMgrInterfaceCode, AccountStubFunc> stubFuncMap_;
63c2b37d2cSopenharmony_ci};
64c2b37d2cSopenharmony_ci}  // namespace AccountSA
65c2b37d2cSopenharmony_ci}  // namespace OHOS
66c2b37d2cSopenharmony_ci
67c2b37d2cSopenharmony_ci#endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
68