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 * Phone Data Type 21 */ 22export class Phone extends DataType { 23 static readonly CONTENT_ITEM_TYPE: string = "phone"; 24 static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.PHONE; 25 static readonly NUMBER: string = DataType.DATA; 26 static readonly TYPE_MOBILE: number = 1; 27 static readonly TYPE_HOME: number = 2; 28 static readonly TYPE_WORK: number = 3; 29 static readonly TYPE_FAX_WORK: number = 4; 30 static readonly TYPE_FAX_HOME: number = 5; 31 static readonly TYPE_PAGER: number = 6; 32 static readonly TYPE_OTHER: number = 7; 33 static readonly TYPE_MAIN: number = 12; 34 static readonly TYPE_CUSTOM: number = 99; 35 36 static getTypeLabelResource(type: number) { 37 switch (type) { 38 case Phone.TYPE_HOME: 39 return $r("app.string.phone_type_home"); 40 case Phone.TYPE_MOBILE: 41 return $r("app.string.phone_type_mobile"); 42 case Phone.TYPE_WORK: 43 return $r("app.string.phone_type_work"); 44 case Phone.TYPE_FAX_WORK: 45 return $r("app.string.phone_type_fax_work"); 46 case Phone.TYPE_FAX_HOME: 47 return $r("app.string.phone_type_fax_home"); 48 case Phone.TYPE_PAGER: 49 return $r("app.string.phone_type_pager"); 50 case Phone.TYPE_OTHER: 51 return $r("app.string.phone_type_other"); 52 case Phone.TYPE_MAIN: 53 return $r("app.string.phone_type_main"); 54 default: 55 return $r("app.string.phone_type_custom"); 56 } 57 } 58 59 constructor() { 60 super(); 61 } 62}