jvgariant-ostree: Correctly deserialize delta operations.

Change-Id: Ic6659d7ea5e9411220571c33979e29471cec897e
diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaOperationType.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaOperationType.java
new file mode 100644
index 0000000..ac2056c
--- /dev/null
+++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaOperationType.java
@@ -0,0 +1,47 @@
+package eu.mulk.jgvariant.ostree;
+
+enum DeltaOperationType {
+  OPEN_SPLICE_AND_CLOSE((byte) 'S'),
+  OPEN((byte) 'o'),
+  WRITE((byte) 'w'),
+  SET_READ_SOURCE((byte) 'r'),
+  UNSET_READ_SOURCE((byte) 'R'),
+  CLOSE((byte) 'c'),
+  BSPATCH((byte) 'B');
+
+  private final byte byteValue;
+
+  DeltaOperationType(byte byteValue) {
+    this.byteValue = byteValue;
+  }
+
+  /**
+   * The serialized byte value.
+   *
+   * @return a serialized byte value for use in GVariant structures.
+   */
+  byte byteValue() {
+    return byteValue;
+  }
+
+  /**
+   * Returns the {@link DeltaOperationType} corresponding to a serialized GVariant value.
+   *
+   * @param byteValue a serialized value as used in GVariant.
+   * @return the {@link DeltaOperationType} corresponding to the serialized value.
+   * @throws IllegalArgumentException if the byte value is invalid.
+   */
+  static DeltaOperationType valueOf(byte byteValue) {
+    return switch (byteValue) {
+      case (byte) 'S' -> OPEN_SPLICE_AND_CLOSE;
+      case (byte) 'o' -> OPEN;
+      case (byte) 'w' -> WRITE;
+      case (byte) 'r' -> SET_READ_SOURCE;
+      case (byte) 'R' -> UNSET_READ_SOURCE;
+      case (byte) 'c' -> CLOSE;
+      case (byte) 'B' -> BSPATCH;
+      default -> throw new IllegalArgumentException(
+          "invalid DeltaOperation: %d".formatted(byteValue));
+    };
+  }
+}