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
16import { NoteType, Favorite, Delete, Top } from './EnumData'
17
18/**
19 * 笔记类
20 */
21export default class NoteData {
22  id: number // 主键
23  title: string // 标题
24  uuid: string // 唯一标识
25  folder_uuid: string // 文件夹uuid
26  content_text: string // 文字内容
27  content_img: string // 图片路径
28  note_type: NoteType // 类型
29  is_top: Top // 是否置顶
30  is_favorite: Favorite // 是否被收藏
31  is_deleted: Delete // 是否被删除
32  created_time: number // 创建时间
33  modified_time: number // 修改时间
34  deleted_time: number // 删除时间
35  slider_value: number //字体进度条大小
36
37  constructor(id: number, title: string, uuid: string, folder_uuid: string, content_text: string, content_img: string,
38              note_type: NoteType, is_top: Top, is_favorite: Favorite, is_deleted: Delete, created_time: number,
39              modified_time: number, deleted_time: number, slider_value: number) {
40    this.id = id
41    this.title = title
42    this.uuid = uuid
43    this.folder_uuid = folder_uuid
44    this.content_text = content_text
45    this.content_img = content_img
46    this.note_type = note_type
47    this.is_top = is_top
48    this.is_favorite = is_favorite
49    this.is_deleted = is_deleted
50    this.created_time = created_time
51    this.modified_time = modified_time
52    this.deleted_time = deleted_time
53    this.slider_value = slider_value
54  }
55
56  /**
57   * 转化为note_table表的valueBucket
58   */
59  toNoteObject(): any{
60    return {
61      "title": this.title,
62      "uuid": this.uuid,
63      "folder_uuid": this.folder_uuid,
64      "content_text": this.content_text,
65      "content_img": this.content_img,
66      "note_type": this.note_type,
67      "is_top": this.is_top,
68      "is_favorite": this.is_favorite,
69      "is_deleted": this.is_deleted,
70      "created_time": this.created_time,
71      "modified_time": this.modified_time,
72      "deleted_time": this.deleted_time,
73      "slider_value":this.slider_value
74    }
75  }
76}