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 DataType from './DataType';
17import {DataItemType} from './DataType';
18
19/**
20 * IM data type
21 */
22export class Im extends DataType {
23  static readonly CONTENT_ITEM_TYPE: string = 'im';
24  static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.IM;
25  static readonly PROTOCOL: string = DataType.DATA;
26  static readonly TYPE_CUSTOM: number = -1;
27  static readonly TYPE_AIM: number = 0;
28  static readonly TYPE_MSN: number = 1;
29  static readonly TYPE_YAHOO: number = 2;
30  static readonly TYPE_SKYPE: number = 3;
31  static readonly TYPE_QQ: number = 4;
32  static readonly TYPE_TALK: number = 5;
33  static readonly TYPE_ICQ: number = 6;
34  static readonly TYPE_JABBER: number = 7;
35  static readonly TYPE_INVALID: number = -2;
36
37  static getTypeLabelResource(type: number) {
38    switch (type) {
39      case Im.TYPE_CUSTOM:
40        return $r('app.string.email_type_home');
41      case Im.TYPE_AIM:
42        return $r('app.string.email_type_work');
43      case Im.TYPE_MSN:
44        return $r('app.string.email_type_other');
45      default:
46        return $r('app.string.email_type_custom');
47    }
48  }
49
50  constructor() {
51    super();
52  }
53}