1/**
2 * Copyright (c) 2024-2024 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 relationalStore from '@ohos.data.relationalStore';
17import { AccessTableTypedef } from '../bean/AccessTableTypedef';
18
19/**
20 * Rdb database config
21 */
22export default class DataShareConstants {
23  public static readonly STORE_CONFIG: relationalStore.StoreConfig = {
24    name: 'access.db',
25    securityLevel: relationalStore.SecurityLevel.S1
26  };
27
28  /**
29   * Access table config
30   */
31  public static readonly ACCESS_TABLE: AccessTableTypedef = {
32    tableName: 'functionAccessTable',
33    sqlCreate: `CREATE TABLE IF NOT EXISTS functionAccessTable(intents TEXT PRIMARY KEY,
34      userId INTEGER,
35      iconBackgroundColorResource TEXT,
36      priority INTEGER,
37      isSupport INTEGER, isClickable INTEGER,
38      displayedMode TEXT,
39      iconResource TEXT,
40      mainTitleResource TEXT,
41      subTitleResource TEXT,
42      showControlAbilityuri TEXT,
43      dstAbilityMode INTEGER,
44      dstAbilityName TEXT,
45      dstBundleName TEXT,
46      bundleName TEXT
47    )`,
48    columns: ['intents', 'userId', 'iconBackgroundColorResource',
49      'priority', 'isSupport', 'isClickable', 'displayedMode', 'iconResource',
50      'mainTitleResource', 'subTitleResource', 'showControlAbility',
51      'dstAbilityMode', 'dstAbilityName', 'dstBundleName', 'bundleName'
52    ]
53  };
54
55  /**
56   * Access table config
57   */
58  public static readonly ANTO_MENU_TABLE_V2: AccessTableTypedef = {
59    tableName: 'auto_menu_table',
60    sqlCreate: `CREATE TABLE IF NOT EXISTS auto_menu_table(
61    businessId TEXT PRIMARY KEY,
62    intents TEXT,
63    userId INTEGER,
64    iconBackgroundColorResource TEXT,
65    priority INTEGER,
66    isSupport INTEGER,
67    isClickable INTEGER,
68    displayedMode TEXT,
69    iconResource TEXT,
70    mainTitleResource TEXT,
71    subTitleResource TEXT,
72    showControlAbilityUri TEXT,
73    dstAbilityMode INTEGER,
74    dstAbilityName TEXT,
75    dstBundleName TEXT,
76    bundleName TEXT
77    )`,
78    columns: ['businessId', 'intents', 'userId', 'iconBackgroundColorResource',
79      'priority', 'isSupport', 'isClickable', 'displayedMode', 'iconResource',
80      'mainTitleResource', 'subTitleResource', 'showControlAbilityUri',
81      'dstAbilityMode', 'dstAbilityName', 'dstBundleName', 'bundleName'
82
83    ]
84  }
85}