package o; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; import org.threeten.bp.OffsetDateTime; /* loaded from: classes.dex */ public final class gsB extends TypeAdapter implements HJa { private InterfaceC15734iCu a; private Gson b; private PYE e; public gsB(Gson gson, InterfaceC15734iCu interfaceC15734iCu, PYE pye) { this.b = gson; this.a = interfaceC15734iCu; this.e = pye; } @Override // com.google.gson.TypeAdapter public final void write(JsonWriter jsonWriter, Object obj) throws IOException { if (obj == null) { jsonWriter.nullValue(); return; } OffsetDateTime offsetDateTime = (OffsetDateTime) obj; Gson gson = this.b; PYE pye = this.e; jsonWriter.beginObject(); C15522gsr c15522gsr = offsetDateTime.dateTime; pye.c(jsonWriter, 322); C15522gsr c15522gsr2 = offsetDateTime.dateTime; DTh.b(gson, C15522gsr.class, c15522gsr2).write(jsonWriter, c15522gsr2); gsI gsi = offsetDateTime.offset; pye.c(jsonWriter, 335); gsI gsi2 = offsetDateTime.offset; DTh.b(gson, gsI.class, gsi2).write(jsonWriter, gsi2); jsonWriter.endObject(); } @Override // com.google.gson.TypeAdapter /* renamed from: read */ public final Object read2(JsonReader jsonReader) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { jsonReader.skipValue(); return null; } OffsetDateTime offsetDateTime = new OffsetDateTime(); Gson gson = this.b; InterfaceC15734iCu interfaceC15734iCu = this.a; jsonReader.beginObject(); while (jsonReader.hasNext()) { int e = interfaceC15734iCu.e(jsonReader); boolean z = jsonReader.peek() != JsonToken.NULL; if (e != 362) { if (e != 449) { jsonReader.skipValue(); } else if (z) { offsetDateTime.offset = (gsI) gson.getAdapter(gsI.class).read2(jsonReader); } else { offsetDateTime.offset = null; jsonReader.nextNull(); } } else if (z) { offsetDateTime.dateTime = (C15522gsr) gson.getAdapter(C15522gsr.class).read2(jsonReader); } else { offsetDateTime.dateTime = null; jsonReader.nextNull(); } } jsonReader.endObject(); return offsetDateTime; } }