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 INTERFACES_INNERKITS_NATIVE_INCLUDE_PHOTO_ALBUM_COLUMN_H
17 #define INTERFACES_INNERKITS_NATIVE_INCLUDE_PHOTO_ALBUM_COLUMN_H
18 
19 #include <set>
20 #include <string>
21 
22 #include "base_column.h"
23 #include "rdb_predicates.h"
24 #include "userfile_manager_types.h"
25 
26 namespace OHOS::Media {
27 #define EXPORT __attribute__ ((visibility ("default")))
28 class PhotoAlbumColumns : BaseColumn {
29 public:
30     // columns only in PhotoAlbumTable
31     static const std::string ALBUM_ID EXPORT;
32     static const std::string ALBUM_TYPE EXPORT;
33     static const std::string ALBUM_SUBTYPE EXPORT;
34     static const std::string ALBUM_NAME EXPORT;
35     static const std::string ALBUM_COVER_URI EXPORT;
36     static const std::string ALBUM_COUNT EXPORT;
37     static const std::string ALBUM_DATE_MODIFIED EXPORT;
38     static const std::string ALBUM_DIRTY EXPORT;
39     static const std::string ALBUM_CLOUD_ID EXPORT;
40     static const std::string ALBUM_IMAGE_COUNT EXPORT;
41     static const std::string ALBUM_VIDEO_COUNT EXPORT;
42     static const std::string ALBUM_LATITUDE EXPORT;
43     static const std::string ALBUM_LONGITUDE EXPORT;
44     static const std::string ALBUM_BUNDLE_NAME EXPORT;
45     static const std::string ALBUM_LOCAL_LANGUAGE EXPORT;
46     static const std::string ALBUM_IS_LOCAL EXPORT;
47     static const std::string ALBUM_DATE_ADDED EXPORT;
48     static const std::string ALBUM_PRIORITY EXPORT;
49     static const std::string ALBUM_LPATH EXPORT;
50     // For api9 compatibility
51     static const std::string ALBUM_RELATIVE_PATH EXPORT;
52 
53     static const std::string CONTAINS_HIDDEN EXPORT;
54     static const std::string HIDDEN_COUNT EXPORT;
55     static const std::string HIDDEN_COVER EXPORT;
56 
57     // For sorting albums
58     static const std::string ALBUM_ORDER EXPORT;
59     static const std::string REFERENCE_ALBUM_ID EXPORT;
60     // default fetch columns
61     static const std::set<std::string> DEFAULT_FETCH_COLUMNS EXPORT;
62     static const std::vector<std::string> LOCATION_DEFAULT_FETCH_COLUMNS EXPORT;
63     static const std::vector<std::string> CITY_DEFAULT_FETCH_COLUMNS EXPORT;
64 
65     // table name
66     static const std::string TABLE EXPORT;
67     // create PhotoAlbumTable sql
68     static const std::string CREATE_TABLE EXPORT;
69 
70     // create indexes for PhotoAlbum
71     static const std::string INDEX_ALBUM_TYPES EXPORT;
72 
73     // create triggers
74     static const std::string CREATE_ALBUM_INSERT_TRIGGER EXPORT;
75     static const std::string CREATE_ALBUM_MDIRTY_TRIGGER EXPORT;
76     static const std::string CREATE_ALBUM_DELETE_TRIGGER EXPORT;
77     static const std::string ALBUM_DELETE_ORDER_TRIGGER EXPORT;
78     static const std::string ALBUM_INSERT_ORDER_TRIGGER EXPORT;
79 
80     // util constants
81     static const std::string ALBUM_URI_PREFIX EXPORT;
82     static const std::string DEFAULT_PHOTO_ALBUM_URI EXPORT;
83     static const std::string HIDDEN_ALBUM_URI_PREFIX EXPORT;
84     static const std::string DEFAULT_HIDDEN_ALBUM_URI EXPORT;
85     static const std::string ANALYSIS_ALBUM_URI_PREFIX EXPORT;
86 
87     // cloud sync uri
88     static const std::string ALBUM_CLOUD_URI_PREFIX EXPORT;
89 
90     EXPORT static bool IsPhotoAlbumColumn(const std::string &columnName);
91 
92     EXPORT static void GetUserAlbumPredicates(const int32_t albumId, NativeRdb::RdbPredicates &predicates,
93         const bool hiddenState);
94     EXPORT static void GetSystemAlbumPredicates(const PhotoAlbumSubType subType, NativeRdb::RdbPredicates &predicates,
95         const bool hiddenState);
96     EXPORT static void GetAnalysisAlbumPredicates(const int32_t albumId, NativeRdb::RdbPredicates &predicates,
97         const bool hiddenState);
98     EXPORT static void GetPortraitAlbumPredicates(const int32_t albumId, NativeRdb::RdbPredicates &predicates,
99         const bool hiddenState);
100     EXPORT static void GetSourceAlbumPredicates(const int32_t albumId, NativeRdb::RdbPredicates &predicates,
101         const bool hiddenState);
102     EXPORT static std::string CheckUploadPhotoAlbumColumns();
103 };
104 } // namespace OHOS::Media
105 #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_PHOTO_ALBUM_COLUMN_H
106