package com.kofax.kmc.klo.logistics.data; import com.kofax.kmc.ken.engines.data.Image; import com.kofax.kmc.klo.logistics.version.KloVersion; import com.kofax.kmc.kut.utilities.AppContextProvider; import com.kofax.kmc.kut.utilities.SdkVersion; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.kmc.kut.utilities.error.IllegalArgumentException; import com.kofax.kmc.kut.utilities.error.KmcRuntimeException; import com.kofax.mobile.sdk._internal.IBus; import com.kofax.mobile.sdk._internal.dagger.Injector; import com.kofax.mobile.sdk.r.a; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.UUID; /* loaded from: classes3.dex */ public class Page implements Serializable, Cloneable { private static final long serialVersionUID = 5250164060821176306L; private transient IBus _bus; private transient String iL; private transient List jn; private transient List jo; private transient int jl = 0; private transient int jm = 0; private transient Side jp = Side.FRONT; private transient UUID jk = UUID.randomUUID(); /* loaded from: classes3.dex */ public enum Side { FRONT, BACK } public Page() { ArrayList arrayList = new ArrayList(); this.jo = arrayList; this.jn = Collections.unmodifiableList(arrayList); this.iL = ""; this._bus = Injector.getInjector(AppContextProvider.getContext()).getIBus(); } public String getPageID() { return this.jk.toString(); } public void addImage(Image image) { if (image == null) { throw new IllegalArgumentException("image parameter is null"); } this.jo.add(image); this.jl = this.jo.size() - 1; this._bus.post(new a(this.iL, image)); } public ErrorInfo removeImage(String str) { Iterator it = this.jo.iterator(); int i = 0; while (it.hasNext()) { if (str.equalsIgnoreCase(it.next().getImageID())) { it.remove(); int i2 = this.jl; if (i == i2) { this.jl = 0; } else if (i < i2) { this.jl = i2 - 1; } return ErrorInfo.KMC_SUCCESS; } i++; } return ErrorInfo.KMC_LO_IMAGE_NOT_FOUND; } public void setCurrentImageIndex(int i) { if (i < 0 || i >= this.jo.size()) { throw new KmcRuntimeException(ErrorInfo.KMC_LO_PAGE_IMAGE_INDEX_INVALID); } this.jl = i; } private void writeObject(ObjectOutputStream objectOutputStream) throws IOException { objectOutputStream.defaultWriteObject(); objectOutputStream.writeObject(Page.class.getName()); objectOutputStream.writeObject(KloVersion.getPackageVersion()); objectOutputStream.writeObject(Integer.valueOf(this.jl)); objectOutputStream.writeObject(this.jk); objectOutputStream.writeObject(Integer.valueOf(this.jm)); objectOutputStream.writeObject(this.jp); objectOutputStream.writeObject(this.jo); } private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException, KmcRuntimeException { objectInputStream.defaultReadObject(); if (Page.class.getName().compareToIgnoreCase((String) objectInputStream.readObject()) == 0) { if (SdkVersion.versionCompatible(KloVersion.getPackageVersion(), (String) objectInputStream.readObject()).booleanValue()) { this.jl = ((Integer) objectInputStream.readObject()).intValue(); this.jk = (UUID) objectInputStream.readObject(); this.jm = ((Integer) objectInputStream.readObject()).intValue(); this.jp = (Side) objectInputStream.readObject(); ArrayList arrayList = (ArrayList) objectInputStream.readObject(); this.jo = arrayList; this.jn = Collections.unmodifiableList(arrayList); return; } throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_VERSION_ERROR); } throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_OBJECT_ERROR); } public void setSide(Side side) { this.jp = side; } public void setSheetID(int i) { this.jm = i; } /* JADX INFO: Access modifiers changed from: protected */ public void setDocumentID(String str) { this.iL = str; } public Side getSide() { return this.jp; } public int getSheetID() { return this.jm; } public List getImages() { return this.jn; } public String getDocumentID() { return this.iL; } public int getCurrentImageIndex() { return this.jl; } }