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 - Relator 21 */ 22export class Relation extends DataType { 23 static readonly CONTENT_ITEM_TYPE: string = "relation"; 24 static readonly CONTENT_ITEM_TYPE_ID: number = DataItemType.RELATION; 25 static readonly NAME: string = DataType.DATA; 26 static readonly TYPE_ASSISTANT: number = 1; 27 static readonly TYPE_BROTHER: number = 2; 28 static readonly TYPE_CHILD: number = 3; 29 static readonly TYPE_PARTNER: number = 4; 30 static readonly TYPE_FATHER: number= 5; 31 static readonly TYPE_FRIEND: number = 6; 32 static readonly TYPE_MANAGER: number = 7; 33 static readonly TYPE_MOTHER: number = 8 34 static readonly TYPE_PARENTS: number = 9; 35 static readonly TYPE_DOMESTIC_PARTNER: number = 10; 36 static readonly TYPE_REFERRED_BY: number = 11; 37 static readonly TYPE_RELATIVE: number = 12; 38 static readonly TYPE_SISTERS: number = 13; 39 static readonly TYPE_SPOUSES: number = 14; 40 41 static getTypeLabelResource(type: number) { 42 switch (type) { 43 case Relation.TYPE_CHILD: 44 return $r("app.string.relationship_type_children"); 45 case Relation.TYPE_DOMESTIC_PARTNER: 46 return $r("app.string.relationship_type_partner"); 47 case Relation.TYPE_ASSISTANT: 48 return $r("app.string.relationship_type_assistant"); 49 case Relation.TYPE_BROTHER: 50 return $r("app.string.relationship_type_brother"); 51 case Relation.TYPE_PARTNER: 52 return $r("app.string.relationship_type_mates"); 53 case Relation.TYPE_FATHER: 54 return $r("app.string.relationship_type_father"); 55 case Relation.TYPE_FRIEND: 56 return $r("app.string.relationship_type_friend"); 57 case Relation.TYPE_MANAGER: 58 return $r("app.string.relationship_type_bosses"); 59 case Relation.TYPE_MOTHER: 60 return $r("app.string.relationship_type_mother"); 61 case Relation.TYPE_PARENTS: 62 return $r("app.string.relationship_type_parents"); 63 case Relation.TYPE_REFERRED_BY: 64 return $r("app.string.relationship_type_introducer"); 65 case Relation.TYPE_RELATIVE: 66 return $r("app.string.relationship_type_kinship"); 67 case Relation.TYPE_SISTERS: 68 return $r("app.string.relationship_type_sisters"); 69 case Relation.TYPE_SPOUSES: 70 return $r("app.string.relationship_type_spouses"); 71 case Relation.TYPE_CUSTOM: 72 return $r("app.string.relationship_type_custom"); 73 default: 74 return $r("app.string.relationship_type_custom"); 75 } 76 } 77 78 constructor() { 79 super(); 80 } 81}