• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 DataColumns from './DataColumns';
17import DataType from './DataType';
18import {DataItemType} from './DataType';
19
20/**
21 * Mailbox Data Type
22 */
23export class Email extends DataType {
24  static readonly CONTENT_ITEM_TYPE: string = "email";
25  static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.EMAIL;
26  static readonly ADDRESS: string = DataType.DATA;
27  static readonly DISPLAY_NAME: string = DataColumns.ALIAS_DETAIL_INTO;
28  static readonly TYPE_HOME: number = 1;
29  static readonly TYPE_WORK: number = 2;
30  static readonly TYPE_OTHER: number = 3;
31
32  static getTypeLabelResource(type: number) {
33    switch (type) {
34      case Email.TYPE_HOME:
35        return $r("app.string.email_type_home");
36      case Email.TYPE_WORK:
37        return $r("app.string.email_type_work");
38      case Email.TYPE_OTHER:
39        return $r("app.string.email_type_other");
40      default:
41        return $r("app.string.email_type_custom");
42    }
43  }
44
45  constructor() {
46    super();
47  }
48}