1115cd2caSopenharmony_ci/*
2115cd2caSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3115cd2caSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4115cd2caSopenharmony_ci * you may not use this file except in compliance with the License.
5115cd2caSopenharmony_ci * You may obtain a copy of the License at
6115cd2caSopenharmony_ci *
7115cd2caSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8115cd2caSopenharmony_ci *
9115cd2caSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10115cd2caSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11115cd2caSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12115cd2caSopenharmony_ci * See the License for the specific language governing permissions and
13115cd2caSopenharmony_ci * limitations under the License.
14115cd2caSopenharmony_ci */
15115cd2caSopenharmony_ci
16115cd2caSopenharmony_ci#ifndef CONTACTPROFILE_TEST_H
17115cd2caSopenharmony_ci#define CONTACTPROFILE_TEST_H
18115cd2caSopenharmony_ci
19115cd2caSopenharmony_ci#include "base_test.h"
20115cd2caSopenharmony_ci
21115cd2caSopenharmony_cinamespace Contacts {
22115cd2caSopenharmony_cinamespace Test {
23115cd2caSopenharmony_ciclass ContactProfileTest : public BaseTest {
24115cd2caSopenharmony_cipublic:
25115cd2caSopenharmony_ci    static constexpr int SLEEP_TIME = 2;
26115cd2caSopenharmony_ci
27115cd2caSopenharmony_ci    ContactProfileTest();
28115cd2caSopenharmony_ci    ~ContactProfileTest();
29115cd2caSopenharmony_ci    int64_t RawContactInsert(std::string displayName, OHOS::DataShare::DataShareValuesBucket &alues);
30115cd2caSopenharmony_ci    int64_t RawContactExpandInsert(
31115cd2caSopenharmony_ci        std::vector<std::string> valueVector, int isFavorite, OHOS::DataShare::DataShareValuesBucket &rawContactValues);
32115cd2caSopenharmony_ci    int64_t RawContactLastContactedInsert(
33115cd2caSopenharmony_ci        std::string displayName, int lastestContactedTime, OHOS::DataShare::DataShareValuesBucket &rawContactValues);
34115cd2caSopenharmony_ci    int64_t ContactDataInsert(int64_t rawContactId, std::string contentType, std::string detailInfo,
35115cd2caSopenharmony_ci        std::string position, OHOS::DataShare::DataShareValuesBucket &contactDataValues);
36115cd2caSopenharmony_ci    int64_t GroupsInsert(std::string groupName, OHOS::DataShare::DataShareValuesBucket &groupValues);
37115cd2caSopenharmony_ci    int64_t ContactBlocklistInsert(std::string phoneNumber, OHOS::DataShare::DataShareValuesBucket &rawContactValues);
38115cd2caSopenharmony_ci    int ContactUpdate(const std::string &tableName, OHOS::DataShare::DataShareValuesBucket updateValues,
39115cd2caSopenharmony_ci        OHOS::DataShare::DataSharePredicates predicates);
40115cd2caSopenharmony_ci    int ContactDelete(const std::string &tableName, OHOS::DataShare::DataSharePredicates predicates);
41115cd2caSopenharmony_ci    std::shared_ptr<OHOS::DataShare::DataShareResultSet> ContactQuery(const std::string &tableName,
42115cd2caSopenharmony_ci        std::vector<std::string> &columns, OHOS::DataShare::DataSharePredicates predicates);
43115cd2caSopenharmony_ci    void QueryAndExpectResult(std::string &tableName, OHOS::DataShare::DataSharePredicates predicates,
44115cd2caSopenharmony_ci        OHOS::DataShare::DataShareValuesBucket &values, std::string testName);
45115cd2caSopenharmony_ci    OHOS::DataShare::DataShareValuesBucket GetAllColumnsValues(
46115cd2caSopenharmony_ci        std::vector<std::string> &columnsInt, std::vector<std::string> &columnsStr);
47115cd2caSopenharmony_ci    void GetAllRawContactColumns(std::vector<std::string> &columnsInt, std::vector<std::string> &columnsStr);
48115cd2caSopenharmony_ci    void GetAllContactDataColumns(std::vector<std::string> &columnInt, std::vector<std::string> &columnStr);
49115cd2caSopenharmony_ci    void GetAllGroupsColumns(std::vector<std::string> &columnInt, std::vector<std::string> &columnStr);
50115cd2caSopenharmony_ci    void GetAllContactBlocklistColumns(std::vector<std::string> &columnInt, std::vector<std::string> &columnStr);
51115cd2caSopenharmony_ci    void GetDetailsContactDataColumns(std::vector<std::string> &columns);
52115cd2caSopenharmony_ci    void MergeColumns(
53115cd2caSopenharmony_ci        std::vector<std::string> &columns, std::vector<std::string> &columnsInt, std::vector<std::string> &columnsStr);
54115cd2caSopenharmony_ci    int64_t RawContactInsertValues(OHOS::DataShare::DataShareValuesBucket &values);
55115cd2caSopenharmony_ci    int64_t ContactDataInsertValues(OHOS::DataShare::DataShareValuesBucket &values);
56115cd2caSopenharmony_ci    int64_t GroupsInsertValues(OHOS::DataShare::DataShareValuesBucket &values);
57115cd2caSopenharmony_ci    int64_t ContactBlocklistInsertValues(OHOS::DataShare::DataShareValuesBucket &values);
58115cd2caSopenharmony_ci    std::vector<OHOS::DataShare::DataShareValuesBucket> GetBatchList(int64_t rawContactId);
59115cd2caSopenharmony_ci    void ClearContacts();
60115cd2caSopenharmony_ci};
61115cd2caSopenharmony_ci} // namespace Test
62115cd2caSopenharmony_ci} // namespace Contacts
63115cd2caSopenharmony_ci#endif // CONTACTPROFILE_TEST_H
64