syntax="proto2";

package metadata;

option optimize_for = SPEED;


message PluginInfo
{
  required sint32 pb_abi_version = 1;
  required string locale = 2;
  required uint64 time = 3;   // modification time of source .xml file

  // true if container is missing options and extensions, and only includes
  // plugin info
  required bool brief_metadata = 4;

  // true if container is missing extensions, string restrictions, and
  // short/long descriptions for the plugin and its options
  required bool basic_metadata = 5;

  required string name = 6;
  optional string short_desc = 7;
  optional string long_desc = 8;
  optional string category = 9;

  repeated string feature = 10;

  message Dependencies
  {
    repeated string after_plugin = 1;
    repeated string before_plugin = 2;

    repeated string require_plugin = 3;
    repeated string require_feature = 4;

    repeated string conflict_plugin = 5;
    repeated string conflict_feature = 6;
  }

  optional Dependencies deps = 11;
}


message PluginBrief
{
  required PluginInfo info = 1;
}


message Plugin
{
  required PluginInfo info = 1;

  message Option
  {
    enum Type	    // This needs to be in the same order as CCSSettingType.
    {
      BOOL 	= 0;
      INT	= 1;
      FLOAT 	= 2;
      STRING 	= 3;
      COLOR 	= 4;
      ACTION	= 5;
      KEY 	= 6;
      BUTTON 	= 7;
      EDGE 	= 8;
      BELL 	= 9;
      MATCH 	= 10;
      LIST 	= 11;
    }

    required string name = 1;
    required Type type = 2;
    optional Type list_type = 3;

    optional string short_desc = 4;
    optional string long_desc = 5;

    optional sint32    group_id = 6 [default = -1];
    optional sint32 subgroup_id = 7 [default = -1];

    optional bool read_only = 8;

    optional bool extensible = 9;
    optional sint32 sort_start = 10 [default = -1];


    message ColorValue
    {
      optional string red	= 1 [default = '0x0000'];
      optional string green	= 2 [default = '0x0000'];
      optional string blue	= 3 [default = '0x0000'];
      optional string alpha	= 4 [default = '0xffff'];
    }

    message GenericValue
    {
      optional bool bool_value = 1; // for bool and bell types
      optional sint32 int_value = 2;
      optional float float_value = 3;
      optional ColorValue color_value = 4;
      optional uint32 edge_value = 5;

      // for all types other than bool/int/float/color/edge/bell
      optional string string_value = 6;
    }

    repeated GenericValue default_value = 11;

    // for int
    optional sint32 int_min = 12;
    optional sint32 int_max = 13;

    message IntDescription
    {
      required sint32 value = 1;
      required string name = 2;
    }

    repeated IntDescription int_desc = 14;

    // for float
    optional float float_min = 15;
    optional float float_max = 16;
    optional float precision = 17;

    message StringRestriction
    {
      required string value = 1;
      required string name = 2;
    }

    repeated StringRestriction str_restriction = 18;

    optional string hints = 19;

    optional bool passive_grab = 20;
    optional bool internal = 21;
    optional bool nodelay = 22;
  }


  message Extension
  {
    required string base_plugin = 1;
    repeated string base_option = 2;

    repeated Option.StringRestriction str_restriction = 3;
  }


  message Screen
  {
    repeated Option option = 1;

    repeated string group_desc = 2;
    repeated string subgroup_desc = 3;
  }

  optional Screen screen = 2;

  repeated Extension extension = 3;
}
