package decoderbufs;

option java_package="io.debezium.connector.postgresql.proto";
option java_outer_classname = "PgProto";
option optimize_for = SPEED;

enum Op {
    INSERT = 0;
    UPDATE = 1;
    DELETE = 2;
}

message Point {
    required double x = 1;
    required double y = 2;
}

message DatumMessage {
    optional string column_name = 1;
    optional int64 column_type = 2;
    oneof datum {
      int32 datum_int32 = 3;
      int64 datum_int64 = 4;
      float datum_float = 5;
      double datum_double = 6;
      bool datum_bool = 7;
      string datum_string = 8;
      bytes datum_bytes = 9;
      Point datum_point = 10;
      bool datum_missing = 11;
    }
}

message TypeInfo {
    required string modifier = 1;
    required bool value_optional = 2;
}

message RowMessage {
    optional uint32 transaction_id = 1;
    optional uint64 commit_time = 2;
    optional string table = 3;
    optional Op op = 4;
    repeated DatumMessage new_tuple = 5;
    repeated DatumMessage old_tuple = 6;
    repeated TypeInfo new_typeinfo = 7;
}
