package com.vinfast.companion.main.ui.testdrive.locationstep;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@dagger.hilt.android.lifecycle.HiltViewModel
@kotlin.Metadata(d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0015\n\u0002\u0018\u0002\n\u0002\b\n\b\u0007\u0018\u00002\u00020\u0001B\u0019\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u001f\u0010\r\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\nH\u0002¢\u0006\u0004\b\r\u0010\u000eJ\u001f\u0010\u000f\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\nH\u0002¢\u0006\u0004\b\u000f\u0010\u000eJ\u0017\u0010\u0010\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\bH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J+\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00130\u00122\f\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00130\u00122\u0006\u0010\t\u001a\u00020\bH\u0002¢\u0006\u0004\b\u0015\u0010\u0016J\u0011\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0002¢\u0006\u0004\b\u0018\u0010\u0019J\u001f\u0010\u001d\u001a\u00020\f2\u0006\u0010\u001a\u001a\u00020\u00132\u0006\u0010\u001c\u001a\u00020\u001bH\u0002¢\u0006\u0004\b\u001d\u0010\u001eJ\u001f\u0010\u001f\u001a\u00020\f2\u0006\u0010\u001a\u001a\u00020\u00132\u0006\u0010\u001c\u001a\u00020\u001bH\u0002¢\u0006\u0004\b\u001f\u0010\u001eJ\u000f\u0010 \u001a\u00020\fH\u0002¢\u0006\u0004\b \u0010!J\u0017\u0010\"\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\bH\u0016¢\u0006\u0004\b\"\u0010\u0011J\u0017\u0010#\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\bH\u0016¢\u0006\u0004\b#\u0010\u0011J\u0017\u0010$\u001a\u00020\f2\u0006\u0010\t\u001a\u00020\bH\u0016¢\u0006\u0004\b$\u0010\u0011J\u000f\u0010%\u001a\u00020\fH\u0016¢\u0006\u0004\b%\u0010!J\u0019\u0010(\u001a\u00020\f2\n\b\u0002\u0010'\u001a\u0004\u0018\u00010&¢\u0006\u0004\b(\u0010)J\u0017\u0010,\u001a\u00020\f2\b\u0010+\u001a\u0004\u0018\u00010*¢\u0006\u0004\b,\u0010-J\u0015\u0010.\u001a\u00020\f2\u0006\u0010\u001c\u001a\u00020\u001b¢\u0006\u0004\b.\u0010/J\u0015\u00100\u001a\u00020\f2\u0006\u0010\u001c\u001a\u00020\u001b¢\u0006\u0004\b0\u0010/R\u0014\u0010\u0005\u001a\u00020\u00048\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b1\u00102R \u00106\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00130\u0012038\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b4\u00105R\u001c\u00108\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u0013038\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b7\u00105R\u001c\u0010:\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010*038\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b9\u00105R\u001a\u0010<\u001a\b\u0012\u0004\u0012\u00020\u001b038\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b;\u00105R$\u0010B\u001a\u0004\u0018\u00010&8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b=\u0010>\u001a\u0004\b?\u0010@\"\u0004\bA\u0010)R\u0018\u0010E\u001a\u0004\u0018\u00010\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bC\u0010DR\u0016\u0010H\u001a\u00020\n8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bF\u0010GR\u001d\u0010L\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00130\u00120I8F¢\u0006\u0006\u001a\u0004\bJ\u0010KR\u0019\u0010N\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00130I8F¢\u0006\u0006\u001a\u0004\bM\u0010KR\u0019\u0010P\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010*0I8F¢\u0006\u0006\u001a\u0004\bO\u0010KR\u0017\u0010R\u001a\b\u0012\u0004\u0012\u00020\u001b0I8F¢\u0006\u0006\u001a\u0004\bQ\u0010K¨\u0006S"}, d2 = {"Lcom/vinfast/companion/main/ui/testdrive/locationstep/TestDriveLocationStepViewModel;", "Lcom/vinfast/companion/main/ui/testdrive/schedule/BaseTestDriveStepViewModel;", "Lcom/vinfast/companion/serviceskit/manager/ITestDriveBookingManager;", "testDriveBookingManager", "Lcom/vinfast/companion/map/manager/IFavoritePlaceManager;", "favoritePlaceManager", "<init>", "(Lcom/vinfast/companion/serviceskit/manager/ITestDriveBookingManager;Lcom/vinfast/companion/map/manager/IFavoritePlaceManager;)V", "Lcom/vinfast/companion/serviceskit/domain/model/TestDriveScheduleFlow;", "flow", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "isTheFirstTimeStart", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "F0", "(Lcom/vinfast/companion/serviceskit/domain/model/TestDriveScheduleFlow;Z)V", "D0", "v0", "(Lcom/vinfast/companion/serviceskit/domain/model/TestDriveScheduleFlow;)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lcom/vinfast/companion/serviceskit/domain/model/ServiceCenter;", "supportedServiceCenters", "h0", "(Ljava/util/List;Lcom/vinfast/companion/serviceskit/domain/model/TestDriveScheduleFlow;)Ljava/util/List;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "q0", "()Ljava/lang/String;", "serviceCenter", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "position", "w0", "(Lcom/vinfast/companion/serviceskit/domain/model/ServiceCenter;I)V", "j0", "i0", "()V", "T", "S", "A0", "C0", "Landroid/location/Location;", "location", "s0", "(Landroid/location/Location;)V", "Lcom/vinfast/companion/serviceskit/domain/model/Province;", "selectedProvince", "B0", "(Lcom/vinfast/companion/serviceskit/domain/model/Province;)V", "z0", "(I)V", "y0", "s", "Lcom/vinfast/companion/map/manager/IFavoritePlaceManager;", "Landroidx/lifecycle/MutableLiveData;", "t", "Landroidx/lifecycle/MutableLiveData;", "_serviceCenterLiveData", "u", "_selectedServiceCenterLiveData", "v", "_selectedProvinceLiveData", "w", "_updateFavoriteStateLiveData", "x", "Landroid/location/Location;", "m0", "()Landroid/location/Location;", "setDeviceLocation", "deviceLocation", "y", "Ljava/lang/String;", "selectedVehicleId", "z", "Z", "hasDeviceLocation", "Landroidx/lifecycle/LiveData;", "r0", "()Landroidx/lifecycle/LiveData;", "serviceCenterLiveData", "p0", "selectedServiceCenterLiveData", "o0", "selectedProvinceLiveData", "u0", "updateFavoriteStateLiveData", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class TestDriveLocationStepViewModel extends com.vinfast.companion.main.ui.testdrive.schedule.BaseTestDriveStepViewModel {

    /* JADX INFO: renamed from: s, reason: from kotlin metadata */
    private final com.vinfast.companion.map.manager.IFavoritePlaceManager favoritePlaceManager;

    /* JADX INFO: renamed from: t, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _serviceCenterLiveData;

    /* JADX INFO: renamed from: u, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _selectedServiceCenterLiveData;

    /* JADX INFO: renamed from: v, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _selectedProvinceLiveData;

    /* JADX INFO: renamed from: w, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _updateFavoriteStateLiveData;

    /* JADX INFO: renamed from: x, reason: from kotlin metadata */
    private android.location.Location deviceLocation;

    /* JADX INFO: renamed from: y, reason: from kotlin metadata */
    private java.lang.String selectedVehicleId;

    /* JADX INFO: renamed from: z, reason: from kotlin metadata */
    private boolean hasDeviceLocation;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public TestDriveLocationStepViewModel(com.vinfast.companion.serviceskit.manager.ITestDriveBookingManager iTestDriveBookingManager, com.vinfast.companion.map.manager.IFavoritePlaceManager iFavoritePlaceManager) {
        super(iTestDriveBookingManager);
        kotlin.jvm.internal.Intrinsics.l(iTestDriveBookingManager, "testDriveBookingManager");
        kotlin.jvm.internal.Intrinsics.l(iFavoritePlaceManager, "favoritePlaceManager");
        this.favoritePlaceManager = iFavoritePlaceManager;
        this._serviceCenterLiveData = new androidx.lifecycle.MutableLiveData();
        this._selectedServiceCenterLiveData = new androidx.lifecycle.MutableLiveData();
        this._selectedProvinceLiveData = new androidx.lifecycle.MutableLiveData();
        this._updateFavoriteStateLiveData = new androidx.lifecycle.MutableLiveData();
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    private final void D0(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow, boolean isTheFirstTimeStart) throws kotlin.NoWhenBranchMatchedException {
        if (isTheFirstTimeStart) {
            v0(flow);
            t0(this, null, 1, null);
        }
        i0();
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    private final void F0(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow, boolean isTheFirstTimeStart) throws kotlin.NoWhenBranchMatchedException {
        if (isTheFirstTimeStart) {
            v0(flow);
            i0();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    public final java.util.List h0(java.util.List supportedServiceCenters, com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow) throws kotlin.NoWhenBranchMatchedException {
        com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenterL;
        if (flow instanceof com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Create) {
            return supportedServiceCenters;
        }
        if (!(flow instanceof com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Reschedule)) {
            throw new kotlin.NoWhenBranchMatchedException();
        }
        com.vinfast.companion.serviceskit.domain.response.TestDriveAppointment testDriveAppointmentG = ((com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Reschedule) flow).g();
        java.util.ArrayList arrayList = new java.util.ArrayList(supportedServiceCenters);
        java.util.Iterator it = supportedServiceCenters.iterator();
        int i = 0;
        while (true) {
            if (!it.hasNext()) {
                i = -1;
                break;
            }
            if (kotlin.jvm.internal.Intrinsics.g(((com.vinfast.companion.serviceskit.domain.model.ServiceCenter) it.next()).y(), (testDriveAppointmentG == null || (serviceCenterL = testDriveAppointmentG.l()) == null) ? null : serviceCenterL.y())) {
                break;
            }
            i++;
        }
        if (i != -1) {
            arrayList.add(0, (com.vinfast.companion.serviceskit.domain.model.ServiceCenter) arrayList.remove(i));
        }
        return arrayList;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void i0() {
        get_enableNextButtonLiveData().q(java.lang.Boolean.valueOf(this._selectedServiceCenterLiveData.f() != null));
    }

    private final void j0(final com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenter, final int position) {
        io.reactivex.rxjava3.core.Completable completableO = this.favoritePlaceManager.b(serviceCenter.k()).t(new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$deleteFavoritePlace$1
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(io.reactivex.rxjava3.disposables.Disposable disposable) {
                kotlin.jvm.internal.Intrinsics.l(disposable, "it");
                this.a.F(com.vinfast.companion.core.base.ProgressType.ProgressDialog.b);
            }
        }).o(new io.reactivex.rxjava3.functions.Action() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.p
            public final void run() {
                com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel.k0(this.a);
            }
        });
        kotlin.jvm.internal.Intrinsics.k(completableO, "doFinally(...)");
        io.reactivex.rxjava3.disposables.Disposable disposableE = com.vinfast.companion.core.extensions.RxExtensionKt.A(completableO).E(new io.reactivex.rxjava3.functions.Action() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.q
            public final void run() {
                com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel.l0(serviceCenter, this, position);
            }
        }, new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$deleteFavoritePlace$4
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(java.lang.Throwable th) {
                kotlin.jvm.internal.Intrinsics.l(th, "error");
                com.vinfast.companion.core.base.BaseViewModel.v(this.a, th, false, 2, (java.lang.Object) null);
            }
        });
        kotlin.jvm.internal.Intrinsics.k(disposableE, "subscribe(...)");
        com.vinfast.companion.core.extensions.RxExtensionKt.k(disposableE, s());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void k0(com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel testDriveLocationStepViewModel) {
        testDriveLocationStepViewModel.w();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void l0(com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenter, com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel testDriveLocationStepViewModel, int i) {
        serviceCenter.J(false);
        serviceCenter.K((java.lang.String) null);
        testDriveLocationStepViewModel._updateFavoriteStateLiveData.n(java.lang.Integer.valueOf(i));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final java.lang.String q0() {
        com.vinfast.companion.serviceskit.domain.response.TestDriveVehicle testDriveVehicleA;
        com.vinfast.companion.serviceskit.domain.model.TestDriveInfo.Vehicle vehicleL = getTestDriveBookingManager().l();
        if (vehicleL == null || (testDriveVehicleA = vehicleL.a()) == null) {
            return null;
        }
        return testDriveVehicleA.getId();
    }

    public static /* synthetic */ void t0(com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel testDriveLocationStepViewModel, android.location.Location location, int i, java.lang.Object obj) {
        if ((i & 1) != 0) {
            location = null;
        }
        testDriveLocationStepViewModel.s0(location);
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    private final void v0(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow) throws kotlin.NoWhenBranchMatchedException {
        if (flow instanceof com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Create) {
            return;
        }
        if (!(flow instanceof com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Reschedule)) {
            throw new kotlin.NoWhenBranchMatchedException();
        }
        com.vinfast.companion.serviceskit.domain.response.TestDriveAppointment testDriveAppointmentG = ((com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow.Reschedule) flow).g();
        if (testDriveAppointmentG == null) {
            return;
        }
        com.vinfast.companion.serviceskit.domain.model.Province province = new com.vinfast.companion.serviceskit.domain.model.Province();
        com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenterL = testDriveAppointmentG.l();
        province.f(serviceCenterL != null ? serviceCenterL.v() : null);
        com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenterL2 = testDriveAppointmentG.l();
        province.g(serviceCenterL2 != null ? serviceCenterL2.w() : null);
        this._selectedProvinceLiveData.q(province);
    }

    private final void w0(final com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenter, final int position) {
        io.reactivex.rxjava3.core.Single singleI = this.favoritePlaceManager.t0(serviceCenter.l(), serviceCenter.z(), serviceCenter.A(), serviceCenter.f(), java.lang.Double.valueOf(serviceCenter.o()), java.lang.Double.valueOf(serviceCenter.p()), com.vinfast.companion.map.model.MapLocationCategory.SERVICE_CENTRE, com.vinfast.companion.map.model.FavoriteType.Other.c).l(new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$insertFavoritePlace$1
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(io.reactivex.rxjava3.disposables.Disposable disposable) {
                kotlin.jvm.internal.Intrinsics.l(disposable, "it");
                this.a.F(com.vinfast.companion.core.base.ProgressType.ProgressDialog.b);
            }
        }).i(new io.reactivex.rxjava3.functions.Action() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.r
            public final void run() {
                com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel.x0(this.a);
            }
        });
        kotlin.jvm.internal.Intrinsics.k(singleI, "doFinally(...)");
        io.reactivex.rxjava3.disposables.Disposable disposableZ = com.vinfast.companion.core.extensions.RxExtensionKt.C(singleI).z(new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$insertFavoritePlace$3
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(com.vinfast.companion.map.model.FavoritePlace favoritePlace) {
                kotlin.jvm.internal.Intrinsics.l(favoritePlace, "favoritePlace");
                serviceCenter.J(true);
                serviceCenter.K(favoritePlace.e());
                this._updateFavoriteStateLiveData.n(java.lang.Integer.valueOf(position));
            }
        }, new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$insertFavoritePlace$4
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(java.lang.Throwable th) {
                kotlin.jvm.internal.Intrinsics.l(th, "error");
                com.vinfast.companion.core.base.BaseViewModel.v(this.a, th, false, 2, (java.lang.Object) null);
            }
        });
        kotlin.jvm.internal.Intrinsics.k(disposableZ, "subscribe(...)");
        com.vinfast.companion.core.extensions.RxExtensionKt.k(disposableZ, s());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void x0(com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel testDriveLocationStepViewModel) {
        testDriveLocationStepViewModel.w();
    }

    public void A0(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow) {
        kotlin.jvm.internal.Intrinsics.l(flow, "flow");
        com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenter = (com.vinfast.companion.serviceskit.domain.model.ServiceCenter) this._selectedServiceCenterLiveData.f();
        if (serviceCenter == null) {
            return;
        }
        androidx.lifecycle.MutableLiveData mutableLiveData = get_navigateToNextStepLiveData();
        com.vinfast.companion.serviceskit.domain.model.Province province = (com.vinfast.companion.serviceskit.domain.model.Province) this._selectedProvinceLiveData.f();
        mutableLiveData.q(new com.vinfast.companion.serviceskit.domain.model.TestDriveInfo.Location(serviceCenter, province != null ? province.c() : null, this.hasDeviceLocation));
    }

    public final void B0(com.vinfast.companion.serviceskit.domain.model.Province selectedProvince) {
        if (kotlin.jvm.internal.Intrinsics.g(this._selectedProvinceLiveData.f(), selectedProvince)) {
            return;
        }
        this._selectedProvinceLiveData.q(selectedProvince);
        t0(this, null, 1, null);
    }

    public void C0() {
        if (Q()) {
            return;
        }
        U();
        this._serviceCenterLiveData.q(kotlin.collections.CollectionsKt.o());
        this._selectedServiceCenterLiveData.q((java.lang.Object) null);
        this._selectedProvinceLiveData.q((java.lang.Object) null);
        get_navigateToNextStepLiveData().q((java.lang.Object) null);
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    @Override // com.vinfast.companion.main.ui.testdrive.schedule.BaseTestDriveStepViewModel
    public void S(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow) throws kotlin.NoWhenBranchMatchedException {
        kotlin.jvm.internal.Intrinsics.l(flow, "flow");
        super.S(flow);
        D0(flow, R());
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    @Override // com.vinfast.companion.main.ui.testdrive.schedule.BaseTestDriveStepViewModel
    public void T(com.vinfast.companion.serviceskit.domain.model.TestDriveScheduleFlow flow) throws kotlin.NoWhenBranchMatchedException {
        kotlin.jvm.internal.Intrinsics.l(flow, "flow");
        super.T(flow);
        boolean zG = kotlin.jvm.internal.Intrinsics.g(this.selectedVehicleId, q0());
        boolean z = R() || !zG;
        this.selectedVehicleId = q0();
        F0(flow, z);
        if (zG) {
            return;
        }
        t0(this, null, 1, null);
    }

    /* JADX INFO: renamed from: m0, reason: from getter */
    public final android.location.Location getDeviceLocation() {
        return this.deviceLocation;
    }

    public final androidx.lifecycle.LiveData o0() {
        return this._selectedProvinceLiveData;
    }

    public final androidx.lifecycle.LiveData p0() {
        return this._selectedServiceCenterLiveData;
    }

    public final androidx.lifecycle.LiveData r0() {
        return this._serviceCenterLiveData;
    }

    public final void s0(android.location.Location location) {
        if (location != null) {
            this.deviceLocation = location;
        }
        this.hasDeviceLocation = this.deviceLocation != null;
        kotlinx.coroutines.BuildersKt.d(androidx.lifecycle.ViewModelKt.a(this), (kotlin.coroutines.CoroutineContext) null, (kotlinx.coroutines.CoroutineStart) null, new com.vinfast.companion.main.ui.testdrive.locationstep.TestDriveLocationStepViewModel$getServiceCenters$1(this, null), 3, (java.lang.Object) null);
    }

    public final androidx.lifecycle.LiveData u0() {
        return this._updateFavoriteStateLiveData;
    }

    public final void y0(int position) {
        if (this._serviceCenterLiveData.f() == null) {
            return;
        }
        java.lang.Object objF = this._serviceCenterLiveData.f();
        kotlin.jvm.internal.Intrinsics.i(objF);
        java.util.List list = (java.util.List) objF;
        if (position < 0 || position >= list.size()) {
            return;
        }
        com.vinfast.companion.serviceskit.domain.model.ServiceCenter serviceCenter = (com.vinfast.companion.serviceskit.domain.model.ServiceCenter) list.get(position);
        if (!serviceCenter.B() || serviceCenter.k() == null) {
            w0(serviceCenter, position);
        } else {
            j0(serviceCenter, position);
        }
    }

    public final void z0(int position) {
        if (this._serviceCenterLiveData.f() == null) {
            return;
        }
        java.lang.Object objF = this._serviceCenterLiveData.f();
        kotlin.jvm.internal.Intrinsics.i(objF);
        java.util.List list = (java.util.List) objF;
        if (position < 0 || position >= list.size()) {
            return;
        }
        this._selectedServiceCenterLiveData.q(list.get(position));
    }
}
