// Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
//     String VALUE =
//             "[{"
//                     + "    \"type\": \"record\","
//                     + "    \"name\": \"decimal\","
//                     + "    \"fields\": [{"
//                     + "        \"name\": \"unscaledValue\","
//                     + "        \"type\": {"
//                     + "            \"type\": \"bytes\","
//                     + "            \"logicalType\": \"big-integer\""
//                     + "        }"
//                     + "    }, {"
//                     + "        \"name\": \"scale\","
//                     + "        \"type\": \"int\""
//                     + "    }],"
//                     + "    \"logicalType\": \"big-decimal\""
//                     + "}, {"
//                     + "    \"type\": \"bytes\","
//                     + "    \"logicalType\": \"big-integer\""
//                     + "}, \"boolean\", {"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"timestamp\","
//                     + "    \"size\": 8,"
//                     + "    \"logicalType\": \"timestamp\""
//                     + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"uuid\","
//                     + "    \"size\": 16,"
//                     + "    \"logicalType\": \"uuid\""
//                     + "}, {"
//                     + "    \"type\": \"array\","
//                     + "    \"items\": [\"decimal\", {"
//                     + "        \"type\": \"bytes\","
//                     + "        \"logicalType\": \"big-integer\""
//                     + "    }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
//                     + "}, {\n"
//                     + "    \"type\": \"map\","
//                     + "    \"values\": [\"decimal\", {"
//                     + "        \"type\": \"bytes\","
//                     + "        \"logicalType\": \"big-integer\""
//                     + "    }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
//                     + "}]";
// 
//     String HEADERS =
//             "{\n"
//                     + "    \"type\": \"map\",\n"
//                     + "    \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
//                     + "        \"type\": \"record\",\n"
//                     + "        \"name\": \"decimal\",\n"
//                     + "        \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
//                     + "        \"fields\": [{\n"
//                     + "            \"name\": \"unscaledValue\",\n"
//                     + "            \"type\": {\n"
//                     + "                \"type\": \"bytes\",\n"
//                     + "                \"logicalType\": \"big-integer\"\n"
//                     + "            }\n"
//                     + "        }, {\n"
//                     + "            \"name\": \"scale\",\n"
//                     + "            \"type\": \"int\"\n"
//                     + "        }],\n"
//                     + "        \"logicalType\": \"big-decimal\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"bytes\",\n"
//                     + "        \"logicalType\": \"big-integer\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"fixed\",\n"
//                     + "        \"name\": \"timestamp\",\n"
//                     + "        \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
//                     + "        \"size\": 8,\n"
//                     + "        \"logicalType\": \"timestamp\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"fixed\",\n"
//                     + "        \"name\": \"uuid\",\n"
//                     + "        \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
//                     + "        \"size\": 16,\n"
//                     + "        \"logicalType\": \"uuid\"\n"
//                     + "    }]\n"
//                     + "}";
//     String TIMESTAMP =
//             "{"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"timestamp\","
//                     + "    \"size\": 8,"
//                     + "    \"logicalType\": \"timestamp\""
//                     + "}";
// }
// 
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }


import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream;
package io.datanerds.avropatch;



/**
 * This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
 * shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
 * resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
 *
 * @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
 */
@ThreadSafe
public class Patch<T> {

    @AvroSchema(DefaultSchema.HEADERS)
    private final Map<String, Object> headers;
    @AvroSchema(DefaultSchema.VALUE)
    private final T resource;
// Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
//     String VALUE =
//             "[{"
//                     + "    \"type\": \"record\","
//                     + "    \"name\": \"decimal\","
//                     + "    \"fields\": [{"
//                     + "        \"name\": \"unscaledValue\","
//                     + "        \"type\": {"
//                     + "            \"type\": \"bytes\","
//                     + "            \"logicalType\": \"big-integer\""
//                     + "        }"
//                     + "    }, {"
//                     + "        \"name\": \"scale\","
//                     + "        \"type\": \"int\""
//                     + "    }],"
//                     + "    \"logicalType\": \"big-decimal\""
//                     + "}, {"
//                     + "    \"type\": \"bytes\","
//                     + "    \"logicalType\": \"big-integer\""
//                     + "}, \"boolean\", {"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"timestamp\","
//                     + "    \"size\": 8,"
//                     + "    \"logicalType\": \"timestamp\""
//                     + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"uuid\","
//                     + "    \"size\": 16,"
//                     + "    \"logicalType\": \"uuid\""
//                     + "}, {"
//                     + "    \"type\": \"array\","
//                     + "    \"items\": [\"decimal\", {"
//                     + "        \"type\": \"bytes\","
//                     + "        \"logicalType\": \"big-integer\""
//                     + "    }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
//                     + "}, {\n"
//                     + "    \"type\": \"map\","
//                     + "    \"values\": [\"decimal\", {"
//                     + "        \"type\": \"bytes\","
//                     + "        \"logicalType\": \"big-integer\""
//                     + "    }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
//                     + "}]";
// 
//     String HEADERS =
//             "{\n"
//                     + "    \"type\": \"map\",\n"
//                     + "    \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
//                     + "        \"type\": \"record\",\n"
//                     + "        \"name\": \"decimal\",\n"
//                     + "        \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
//                     + "        \"fields\": [{\n"
//                     + "            \"name\": \"unscaledValue\",\n"
//                     + "            \"type\": {\n"
//                     + "                \"type\": \"bytes\",\n"
//                     + "                \"logicalType\": \"big-integer\"\n"
//                     + "            }\n"
//                     + "        }, {\n"
//                     + "            \"name\": \"scale\",\n"
//                     + "            \"type\": \"int\"\n"
//                     + "        }],\n"
//                     + "        \"logicalType\": \"big-decimal\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"bytes\",\n"
//                     + "        \"logicalType\": \"big-integer\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"fixed\",\n"
//                     + "        \"name\": \"timestamp\",\n"
//                     + "        \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
//                     + "        \"size\": 8,\n"
//                     + "        \"logicalType\": \"timestamp\"\n"
//                     + "    }, {\n"
//                     + "        \"type\": \"fixed\",\n"
//                     + "        \"name\": \"uuid\",\n"
//                     + "        \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
//                     + "        \"size\": 16,\n"
//                     + "        \"logicalType\": \"uuid\"\n"
//                     + "    }]\n"
//                     + "}";
//     String TIMESTAMP =
//             "{"
//                     + "    \"type\": \"fixed\","
//                     + "    \"name\": \"timestamp\","
//                     + "    \"size\": 8,"
//                     + "    \"logicalType\": \"timestamp\""
//                     + "}";
// }
// 
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }


// Path: src/main/java/io/datanerds/avropatch/Patch.java
import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream;

package io.datanerds.avropatch;



/**
 * This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
 * shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
 * resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
 *
 * @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
 */
@ThreadSafe
public class Patch<T> {

    @AvroSchema(DefaultSchema.HEADERS)
    private final Map<String, Object> headers;
    @AvroSchema(DefaultSchema.VALUE)
    private final T resource;
    @AvroSchema(DefaultSchema.TIMESTAMP)