package com.vinfast.companion.map.repository;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
@kotlin.Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u0011\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u0017\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\t\u0010\nJ+\u0010\u0011\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00100\u000f2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\u000e\u001a\u00020\rH\u0016¢\u0006\u0004\b\u0011\u0010\u0012R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\t\u0010\u0013¨\u0006\u0014"}, d2 = {"Lcom/vinfast/companion/map/repository/RecentSearchRepositoryProvider;", "Lcom/vinfast/companion/map/repository/RecentLocationSearchRepository;", "Lcom/vinfast/companion/map/dao/RecentSearchDao;", "recentSearchDao", "<init>", "(Lcom/vinfast/companion/map/dao/RecentSearchDao;)V", "Lcom/vinfast/companion/map/model/RecentSearch;", "recentSearch", "", "a", "(Lcom/vinfast/companion/map/model/RecentSearch;)V", "", "count", "", "userEmail", "Lio/reactivex/rxjava3/core/Observable;", "", "b", "(ILjava/lang/String;)Lio/reactivex/rxjava3/core/Observable;", "Lcom/vinfast/companion/map/dao/RecentSearchDao;", "hereSdk_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class RecentSearchRepositoryProvider implements com.vinfast.companion.map.repository.RecentLocationSearchRepository {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final com.vinfast.companion.map.dao.RecentSearchDao recentSearchDao;

    public RecentSearchRepositoryProvider(com.vinfast.companion.map.dao.RecentSearchDao recentSearchDao) {
        kotlin.jvm.internal.Intrinsics.l(recentSearchDao, "recentSearchDao");
        this.recentSearchDao = recentSearchDao;
    }

    @Override // com.vinfast.companion.map.repository.RecentLocationSearchRepository
    public void a(com.vinfast.companion.map.model.RecentSearch recentSearch) {
        com.vinfast.companion.map.model.MapLocationCategory category;
        kotlin.jvm.internal.Intrinsics.l(recentSearch, "recentSearch");
        java.lang.String title = recentSearch.getTitle();
        java.lang.String hereId = recentSearch.getHereId();
        java.lang.String address = recentSearch.getAddress();
        java.lang.String userId = recentSearch.getUserId();
        com.vinfast.companion.map.model.VinFastServicePlace vinFastServicePlace = recentSearch.getVinFastServicePlace();
        java.lang.String vinFastId = vinFastServicePlace != null ? vinFastServicePlace.getVinFastId() : null;
        com.vinfast.companion.map.model.VinFastServicePlace vinFastServicePlace2 = recentSearch.getVinFastServicePlace();
        java.lang.String strName = (vinFastServicePlace2 == null || (category = vinFastServicePlace2.getCategory()) == null) ? null : category.name();
        com.vinfast.companion.map.model.VinFastServicePlace vinFastServicePlace3 = recentSearch.getVinFastServicePlace();
        java.lang.Double dValueOf = vinFastServicePlace3 != null ? java.lang.Double.valueOf(vinFastServicePlace3.getLatitude()) : null;
        com.vinfast.companion.map.model.VinFastServicePlace vinFastServicePlace4 = recentSearch.getVinFastServicePlace();
        this.recentSearchDao.a(new com.vinfast.companion.map.dao.entity.RecentSearchEntity(null, title, hereId, address, userId, vinFastId, strName, dValueOf, vinFastServicePlace4 != null ? java.lang.Double.valueOf(vinFastServicePlace4.getLongitude()) : null, java.lang.System.currentTimeMillis(), 1, null));
    }

    @Override // com.vinfast.companion.map.repository.RecentLocationSearchRepository
    public io.reactivex.rxjava3.core.Observable b(int count, java.lang.String userEmail) {
        kotlin.jvm.internal.Intrinsics.l(userEmail, "userEmail");
        io.reactivex.rxjava3.core.Observable map = this.recentSearchDao.b(count, userEmail).map(new io.reactivex.rxjava3.functions.Function() { // from class: com.vinfast.companion.map.repository.RecentSearchRepositoryProvider$getDistinctTopRecentSearch$1
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final java.util.List apply(java.util.List list) {
                kotlin.jvm.internal.Intrinsics.l(list, "entities");
                java.util.ArrayList arrayList = new java.util.ArrayList(kotlin.collections.CollectionsKt.z(list, 10));
                java.util.Iterator<T> it = list.iterator();
                while (it.hasNext()) {
                    arrayList.add(com.vinfast.companion.map.model.RecentSearch.INSTANCE.a((com.vinfast.companion.map.dao.entity.RecentSearchEntity) it.next()));
                }
                return arrayList;
            }
        });
        kotlin.jvm.internal.Intrinsics.k(map, "map(...)");
        return map;
    }
}
