syntax="proto3";
package foxtrot;

import "google/protobuf/timestamp.proto";

message empty {}


enum simplevalue_types
{
    FLOAT_TYPE = 0 ;
    INT_TYPE = 1;
    UNSIGNED_TYPE = 2;
    BOOL_TYPE = 3;
    STRING_TYPE = 4;
    VOID_TYPE = 5;
  //0.3.0 new types
    DATETIME_TYPE = 6;
  //0.3.1 new types
    REMOTE_HANDLE_TYPE = 7;
}

enum byte_data_types
{
    UCHAR_TYPE = 0;
    CHAR_TYPE = 1;
    USHORT_TYPE = 2;
    UINT_TYPE = 3;
    ULONG_TYPE = 4;
    SHORT_TYPE = 5;
    IINT_TYPE = 6;
    LONG_TYPE = 7;
    BFLOAT_TYPE =8;
    BDOUBLE_TYPE = 9;

  //0.3.0 new types
    BCOMPLEX_TYPE=11;
    BDATETIME_TYPE=12;
    BOPAQUE_TYPE=13;
}


enum variant_types
{
    SIMPLEVAR_TYPE = 0;
    STRUCT_TYPE = 1;
    ENUM_TYPE = 2;
    TUPLE_TYPE = 3;
    HOMOG_ARRAY_TYPE=4;
    UNION_TYPE = 5;
    DYNAMIC_TYPE=6;
}

message variant_descriptor
{
    variant_types variant_type = 1;
    simplevalue_types simplevalue_type = 2;
    uint32 simplevalue_sizeof = 3;
    struct_descriptor struct_desc = 4;
    enum_descriptor enum_desc = 5;
    tuple_descriptor tuple_desc = 6;
    homog_array_descriptor homog_array_desc = 7;
    union_descriptor union_desc = 9;
  //new in 0.3.0
    string cpp_type_name = 8;
    bool is_nullable = 10;
}

message struct_descriptor
{
    string struct_name = 1;
    map<string, variant_descriptor> struct_map = 2;
}

message enum_descriptor
{
    string enum_name = 1;
    map<string, uint32> enum_map = 2;
}

message tuple_descriptor
{
    repeated variant_descriptor tuple_map = 1;
}

message homog_array_descriptor
{
  bool has_fixed_size = 3;
  uint64 fixed_size = 4;
  variant_descriptor value_type = 6;
}


message union_descriptor
{
  repeated variant_descriptor possible_types = 1;

}

message ft_variant {
    oneof value {
        ft_simplevariant simplevar = 1;
        ft_struct structval = 2;
        ft_enum enumval = 3;
        ft_tuple tupleval = 4;

	//0.3.0 new types
	ft_homog_array arrayval = 5;
    }

  //0.3.0 new values
}

message ft_simplevariant {
    oneof value {
        double dblval = 1;
        sint64 intval = 2;
        uint64 uintval = 3;
        bool boolval = 4;
        string stringval = 5;
	google.protobuf.Timestamp tstampval = 8;
	uint64 handleval = 9;
        }
    uint32 size = 6;
    bool is_void = 7;
}


message ft_struct {
    string struct_name = 1;
    map<string, ft_variant> value = 2;
}


message ft_enum {
    enum_descriptor desc = 1;
    uint32 enum_value = 2;
}

message ft_tuple {
    repeated ft_variant value = 2;
}


// new in 0.3.0
message ft_homog_array {
  oneof array {
    ft_homog_array_decoded arr_decoded = 1;
    ft_homog_array_encoded arr_encoded = 2;
    ft_heavy_array arr_heavy = 3;
  }
}

//new in 0.3.0
message ft_homog_array_encoded
{
  byte_data_types dtp = 1;
  bytes data = 2;
}

message ft_dynamic_type {
    ft_variant value = 1;
    variant_descriptor desc = 2;
}


//new in 0.5.0
message ft_heavy_array {
  repeated ft_variant data = 1;
}


//new in 0.3.0
message ft_homog_array_decoded
{
  oneof array
  {
    ft_uint8_arr arr_uint8 = 1;
    //NOTE there is no 16-bit native protobuf type
    ft_uint32_arr arr_uint16 = 2;
    ft_sint32_arr arr_sint16 = 3;
    ft_uint32_arr arr_uint32 = 4;
    ft_sint32_arr arr_sint32 = 5;
    ft_uint64_arr arr_uint64 = 6;
    ft_sint64_arr arr_sint64 = 7;
    ft_float_arr arr_float = 8;
    ft_double_arr arr_double = 9;
  }
}

message ft_uint8_arr
{
  repeated uint32 values = 1;
}

message ft_uint16_arr
{
  //note no native 16 bit protobuf types
  repeated uint32 values = 1;
}

message ft_sint16_arr
{
  repeated sint32 values = 1;
}

message ft_uint32_arr
{
  repeated uint32 values = 1;
}

message ft_sint32_arr
{
  repeated sint32 values = 1;
}

message ft_uint64_arr
{
  repeated uint64 values = 1;
}

message ft_sint64_arr
{
  repeated sint64 values = 1;
}

message ft_float_arr
{
  repeated float values = 1;
}

message ft_double_arr
{
  repeated double values = 1;
}



