package ib;

import ca.canadapost.core.data.db.cupboard.model.CustomsFormObject;
import ca.canadapost.core.data.db.cupboard.model.CustomsFormSenderObject;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes4.dex */
public class q implements s0 {

    /* renamed from: a, reason: collision with root package name */
    private final n9.a f22942a;

    public q(n9.a aVar) {
        this.f22942a = aVar;
    }

    @Override // ib.s0
    public boolean a(CustomsFormObject customsFormObject) {
        if (customsFormObject._id != null) {
            return this.f22942a.a().f(customsFormObject);
        }
        return false;
    }

    @Override // ib.s0
    public Long b(CustomsFormSenderObject customsFormSenderObject) {
        Long l10 = customsFormSenderObject._id;
        CustomsFormSenderObject f10 = l10 != null ? f(l10) : null;
        if (f10 != null) {
            customsFormSenderObject._id = f10._id;
        }
        Long valueOf = Long.valueOf(this.f22942a.a().i(customsFormSenderObject));
        customsFormSenderObject._id = valueOf;
        return valueOf;
    }

    @Override // ib.s0
    public Long c(CustomsFormObject customsFormObject) {
        Long l10 = customsFormObject._id;
        CustomsFormObject e10 = l10 != null ? e(l10) : null;
        if (e10 != null) {
            customsFormObject._id = e10._id;
        }
        Long valueOf = Long.valueOf(this.f22942a.a().i(customsFormObject));
        customsFormObject._id = valueOf;
        return valueOf;
    }

    @Override // ib.s0
    public List d() {
        try {
            return this.f22942a.a().j(CustomsFormSenderObject.class).d();
        } catch (Exception e10) {
            e10.printStackTrace();
            return new ArrayList();
        }
    }

    public CustomsFormObject e(Long l10) {
        try {
            return (CustomsFormObject) this.f22942a.a().j(CustomsFormObject.class).a(l10.longValue()).b();
        } catch (Exception e10) {
            e10.printStackTrace();
            return null;
        }
    }

    public CustomsFormSenderObject f(Long l10) {
        try {
            return (CustomsFormSenderObject) this.f22942a.a().j(CustomsFormSenderObject.class).a(l10.longValue()).b();
        } catch (Exception e10) {
            e10.printStackTrace();
            return null;
        }
    }

    @Override // ib.s0
    public List getAll() {
        try {
            return this.f22942a.a().j(CustomsFormObject.class).d();
        } catch (Exception e10) {
            e10.printStackTrace();
            return new ArrayList();
        }
    }
}
