18779efd5Sopenharmony_ci/**
28779efd5Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
38779efd5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48779efd5Sopenharmony_ci * you may not use this file except in compliance with the License.
58779efd5Sopenharmony_ci * You may obtain a copy of the License at
68779efd5Sopenharmony_ci *
78779efd5Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88779efd5Sopenharmony_ci *
98779efd5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108779efd5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118779efd5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128779efd5Sopenharmony_ci * See the License for the specific language governing permissions and
138779efd5Sopenharmony_ci * limitations under the License.
148779efd5Sopenharmony_ci */
158779efd5Sopenharmony_ci
168779efd5Sopenharmony_ciimport { SearchContacts } from '../contract/SearchContacts';
178779efd5Sopenharmony_ciimport { Data } from '../contract/Data';
188779efd5Sopenharmony_ciimport { DataItem } from '../entity/DataItem';
198779efd5Sopenharmony_ci
208779efd5Sopenharmony_ciexport default class SearchContact {
218779efd5Sopenharmony_ci  readonly id: number;
228779efd5Sopenharmony_ci  readonly values: Map<string, any>;
238779efd5Sopenharmony_ci  readonly dataItems: DataItem[];
248779efd5Sopenharmony_ci  constructor(id: number, values: Map<string, any>) {
258779efd5Sopenharmony_ci    this.id = id;
268779efd5Sopenharmony_ci    this.values = values;
278779efd5Sopenharmony_ci    this.dataItems = [];
288779efd5Sopenharmony_ci  }
298779efd5Sopenharmony_ci
308779efd5Sopenharmony_ci  static fromResultSet(resultSet: any): SearchContact{
318779efd5Sopenharmony_ci    let contentValues: Map<string, any> = new Map();
328779efd5Sopenharmony_ci    contentValues.set(SearchContacts.ACCOUNT_ID, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.ACCOUNT_ID)));
338779efd5Sopenharmony_ci    contentValues.set(SearchContacts.CONTACT_ID, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.CONTACT_ID)));
348779efd5Sopenharmony_ci    contentValues.set(SearchContacts.RAW_CONTACT_ID, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.RAW_CONTACT_ID)));
358779efd5Sopenharmony_ci    contentValues.set(SearchContacts.SEARCH_NAME, resultSet.getString(resultSet.getColumnIndex(SearchContacts.SEARCH_NAME)));
368779efd5Sopenharmony_ci    contentValues.set(SearchContacts.DISPLAY_NAME, resultSet.getString(resultSet.getColumnIndex(SearchContacts.DISPLAY_NAME)));
378779efd5Sopenharmony_ci    contentValues.set(SearchContacts.PHONETIC_NAME, resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHONETIC_NAME)));
388779efd5Sopenharmony_ci    contentValues.set(SearchContacts.PHOTO_ID, resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHOTO_ID)));
398779efd5Sopenharmony_ci    contentValues.set(SearchContacts.PHOTO_FILE_ID, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.PHOTO_FILE_ID)));
408779efd5Sopenharmony_ci    contentValues.set(SearchContacts.IS_DELETED, resultSet.getString(resultSet.getColumnIndex(SearchContacts.IS_DELETED)));
418779efd5Sopenharmony_ci    contentValues.set(SearchContacts.POSITION, resultSet.getString(resultSet.getColumnIndex(SearchContacts.POSITION)));
428779efd5Sopenharmony_ci    contentValues.set(SearchContacts.PHOTO_FIRST_NAME, resultSet.getString(resultSet.getColumnIndex(SearchContacts.PHOTO_FIRST_NAME)));
438779efd5Sopenharmony_ci    contentValues.set(SearchContacts.SORT_FIRST_LETTER, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.SORT_FIRST_LETTER)));
448779efd5Sopenharmony_ci    contentValues.set(SearchContacts.CUSTOM_DATA, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.CUSTOM_DATA)));
458779efd5Sopenharmony_ci    contentValues.set(SearchContacts.DETAIL_INFO, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.DETAIL_INFO)));
468779efd5Sopenharmony_ci    contentValues.set(SearchContacts.CONTENT_TYPE, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.CONTENT_TYPE)));
478779efd5Sopenharmony_ci    contentValues.set(SearchContacts.HAS_PHONE_NUMBER, resultSet.getLong(resultSet.getColumnIndex(SearchContacts.HAS_PHONE_NUMBER)));
488779efd5Sopenharmony_ci    return new SearchContact(resultSet.getLong(resultSet.getColumnIndex(SearchContacts.ID)), contentValues);
498779efd5Sopenharmony_ci  }
508779efd5Sopenharmony_ci}
518779efd5Sopenharmony_ci
52