1/*
2 * Copyright (c) 2022 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/**
17 * table name
18 */
19export enum TableName {
20  FolderTable = "folder_table",
21  NoteTable = "note_table",
22  AttachmentTable = "attachment_table",
23  FormTable = "form_table"
24}
25
26/**
27 * folder table column
28 */
29export enum FolderTableColumn {
30  Id = "id", // 主键
31  Name = "name", // 名称
32  Uuid = "uuid", // 唯一标识
33  Color = "color", // 图标颜色
34  FolderType = "folder_type", // 类型
35  IsDeleted = "is_deleted", // 是否被删除
36  CreatedTime = "created_time", // 创建时间
37  ModifiedTime = "modified_time" // 修改时间
38}
39
40/**
41 * note table column
42 */
43export enum NoteTableColumn {
44  Id = "id", // 主键
45  Title = "title", // 标题
46  Uuid = "uuid", // 唯一标识
47  FolderUuid = "folder_uuid", // 文件夹uuid
48  ContentText = "content_text", // 文字内容
49  ContentImg = "content_img", // 图片路径
50  NoteType = "note_type", // 类型
51  IsTop = "is_top", // 是否置顶
52  IsFavorite = "is_favorite", // 是否被收藏
53  IsDeleted = "is_deleted", // 是否被删除
54  CreatedTime = "created_time", // 创建时间
55  ModifiedTime = "modified_time", // 修改时间
56  DeletedTime = "deleted_time", // 删除时间
57  SliderValue = "slider_value"
58}
59
60/**
61 * attachment table column
62 */
63export enum AttachmentTableColumn {
64  Id = "id", // 主键
65  Uuid = "uuid", // 唯一标识
66  NoteUuid = "note_uuid", // 笔记uuid
67  Path = "path", // 路径
68  AttachmentType = "attachment_type", // 类型
69  CreatedTime = "created_time", // 创建时间
70  ModifiedTime = "modified_time" // 修改时间
71}
72
73/**
74 * form table column
75 */
76export enum FormTableColumn {
77  Id = "id", // 卡片id
78  Name = "name", // 卡片名称
79  Dimension = "dimension", // 卡片尺寸
80}
81
82/**
83 * Database table init sql
84 */
85export enum TableSql {
86  FolderTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.FolderTable + " ("
87  + FolderTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT,"
88  + FolderTableColumn.Name + " TEXT NOT NULL,"
89  + FolderTableColumn.Uuid + " TEXT NOT NULL,"
90  + FolderTableColumn.Color + " TEXT DEFAULT '#ffffffff',"
91  + FolderTableColumn.FolderType + " INTEGER DEFAULT 1,"
92  + FolderTableColumn.IsDeleted + " INTEGER DEFAULT 0,"
93  + FolderTableColumn.CreatedTime + " INTEGER,"
94  + FolderTableColumn.ModifiedTime + " INTEGER"
95  + ")",
96
97  NoteTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.NoteTable + " ("
98  + NoteTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT,"
99  + NoteTableColumn.Title + " TEXT NOT NULL,"
100  + NoteTableColumn.Uuid + " TEXT NOT NULL,"
101  + NoteTableColumn.FolderUuid + " TEXT,"
102  + NoteTableColumn.ContentText + " TEXT,"
103  + NoteTableColumn.ContentImg + " TEXT,"
104  + NoteTableColumn.NoteType + " INTEGER DEFAULT 1,"
105  + NoteTableColumn.IsTop + " INTEGER DEFAULT 0,"
106  + NoteTableColumn.IsFavorite + " INTEGER DEFAULT 0,"
107  + NoteTableColumn.IsDeleted + " INTEGER DEFAULT 0,"
108  + NoteTableColumn.CreatedTime + " INTEGER,"
109  + NoteTableColumn.ModifiedTime + " INTEGER,"
110  + NoteTableColumn.DeletedTime + " INTEGER,"
111  + NoteTableColumn.SliderValue + " INTEGER "
112  + ")",
113
114  AttachmentTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.AttachmentTable + " ("
115  + AttachmentTableColumn.Id + " INTEGER PRIMARY KEY AUTOINCREMENT,"
116  + AttachmentTableColumn.Uuid + " TEXT NOT NULL,"
117  + AttachmentTableColumn.NoteUuid + " TEXT NOT NULL,"
118  + AttachmentTableColumn.Path + " TEXT,"
119  + AttachmentTableColumn.AttachmentType + " INTEGER DEFAULT 0,"
120  + AttachmentTableColumn.CreatedTime + " INTEGER,"
121  + AttachmentTableColumn.ModifiedTime + " INTEGER"
122  + ")",
123
124  FormTableSQL = "CREATE TABLE IF NOT EXISTS " + TableName.FormTable + " ("
125  + FormTableColumn.Id + " TEXT NOT NULL,"
126  + FormTableColumn.Name + " TEXT NOT NULL,"
127  + FormTableColumn.Dimension + " TEXT NOT NULL"
128  + ")"
129}
130
131/**
132 * system Define folder
133 */
134export enum SysDefFolder {
135  AllNotes = "sys_def_allNotes",
136  UnClassified = "sys_def_unClassified",
137  MyFavorites = "sys_def_myFavorites",
138  RecentDeletes = "sys_def_recentDeletes",
139  Personal = "sys_def_personal",
140  Life = "sys_def_life",
141  Work = "sys_def_work"
142}
143
144/**
145 * system Define folder uuid
146 */
147export enum SysDefFolderUuid {
148  AllNotes = "sys_def_allNotes_uuid",
149  UnClassified = "sys_def_unClassified_uuid",
150  MyFavorites = "sys_def_myFavorites_uuid",
151  RecentDeletes = "sys_def_recentDeletes_uuid",
152  Personal = "sys_def_personal_uuid",
153  Life = "sys_def_life_uuid",
154  Work = "sys_def_work_uuid"
155}
156
157/**
158 * folder type
159 */
160export enum FolderType {
161  SysDef, // System definition
162  CusDef, // User defined
163  FeatureDef // feature defined: MyFavorites & RecentDeletes
164}
165
166/**
167 * note type
168 */
169export enum NoteType {
170  SysDef,
171  CusDef
172}
173
174/**
175 * attachment type
176 */
177export enum AttachmentType {
178  Image,
179  Voice,
180  HandWriting
181}
182
183/**
184 * Note favorite status
185 */
186export enum Favorite {
187  No,
188  Yes
189}
190
191/**
192 * Note delete status
193 */
194export enum Delete {
195  No,
196  Yes
197}
198
199/**
200 * Note top status
201 */
202export enum Top {
203  No,
204  Yes
205}
206
207/**
208 * delete file type
209 */
210export enum DeleteFileType {
211  NoteData,
212  FolderData
213}