// # fx-framework schema options (`fx.v1`)
//
// Custom options on the messages and fields of the fx-framework schemas (`vp_control.v1`): a
// field's **range** (`min`, `max`), the text formats of string fields (`fraction`, `matrix`,
// `as_written`), product limits (`only_if`) and its line in a **preset INI** file (`ini_section`,
// `ini_key` and the other `ini_*` options, `inverted`: the names a preset file uses for the same
// setting).
syntax = "proto2";

package fx.v1;

import "google/protobuf/descriptor.proto";

// How a value is written to and read from a preset INI file (`key = value` lines in a `[section]`).
enum IniFormat {
  // A decimal integer (`%d`). Read with `strtol` (base 0: `0x10` is hex, `010` octal, unless
  // `ini_decimal`); stored without clamping.
  INI_INT = 0;
  // `on` / `off`. Read: `on` or `1` is true, anything else false. With `inverted`, `on` stands
  // for the field's value false.
  INI_ON_OFF = 1;
  // A short identifier, written as is. An empty value is written as `ini_empty` (default `none`);
  // `ini_empty` or `none` read back as empty.
  INI_ID = 2;
  // The name at the value's index in `ini_names`. Read: the index of the name; a word not in the
  // list reads 0 (or keeps the value, with `ini_keep_unknown`).
  INI_NAMES = 3;
  // The name at the value's index in `ini_names`, or the number when the value is out of the list
  // (`ini_other`: a text instead). Read: the index of the name, else the number (`strtol`).
  INI_NAMES_OR_NUMBER = 4;
  // A real number: `%1.15g`, or `%1.17g` when that does not read back as the same double. Read with
  // `strtod`.
  INI_DOUBLE = 5;
  // A matrix field's text: its numbers row by row, joined by `|`. Read loosely: the identity
  // matrix's numbers where numbers are missing, empty parts skipped, a word reads 0.
  INI_MATRIX = 6;
}

extend google.protobuf.FieldOptions {
  // **Range**: the lowest value the field takes. The API rejects values below it. For a `matrix`
  // field: each number. Values from -32768 to 32767.
  optional sint32 min = 50002;
  // **Range**: the highest value the field takes (see `min`).
  optional sint32 max = 50003;
  // The field's key in the preset INI section of its message (`ini_section`); none: presets do not
  // carry the field in that section.
  optional string ini_key = 50005;
  // How the value is written in the preset INI (default `INI_INT`).
  optional IniFormat ini_format = 50006;
  // `INI_NAMES` / `INI_NAMES_OR_NUMBER`: the names of the values 0, 1, 2, ..., comma-separated.
  optional string ini_names = 50007;
  // `INI_ID`: how an empty value is written (default `none`).
  optional string ini_empty = 50008;
  // `INI_INT`: the word written for a negative value; it reads back as -1.
  optional string ini_negative = 50009;
  // `INI_NAMES` / `INI_NAMES_OR_NUMBER`: the word written for a value outside the list (instead of
  // the last name / the number).
  optional string ini_other = 50018;
  // `inherit` is written for the field's unset value (-1 for a number, a matrix of zeros; a name
  // list writes `ini_other`) and reads as the live value of the field (the color tables).
  optional bool ini_inherit = 50019;
  // `INI_NAMES` / `INI_NAMES_OR_NUMBER`: names are read ignoring case.
  optional bool ini_nocase = 50020;
  // `INI_NAMES`: a word not in `ini_names` leaves the value as it is (otherwise it reads 0).
  optional bool ini_keep_unknown = 50021;
  // `INI_INT`: read as a decimal number (otherwise `strtol` base 0: `0x..` hex, `0..` octal).
  optional bool ini_decimal = 50022;
  // A string field holding a fraction: the text `"num/den"`, reduced, the denominator positive
  // (unless `as_written`).
  optional bool fraction = 50013;
  // The field exists only on some products: the name of a firmware feature. Where the firmware
  // lacks it, the API reports the field as `NOT_ON_THIS_PRODUCT`.
  optional string only_if = 50014;
  // A `fraction` kept as written: `"4/4"` stays `"4/4"` and is not `"1/1"` (the manual prescale:
  // n of n samples); never reduced on the way.
  optional bool as_written = 50015;
  // A string field holding a square matrix of doubles: its numbers row by row, joined by `|`
  // (`"1|0|0|0|1|0|0|0|1"` for a 3 x 3 identity). `min` / `max` limit each number.
  optional bool matrix = 50016;
  // A bool written to the preset INI as its opposite: the field is named for "off", the preset line
  // for "on" (Retro FX's switches: `retro_fx = on` is `RetroFx.off` false). The API carries the
  // field's value, as it is named.
  optional bool inverted = 50017;
}

extend google.protobuf.MessageOptions {
  // The message's section in a preset INI file, without brackets (`analog-path` for
  // `[analog-path]`).
  optional string ini_section = 50102;
}
