// This file is part of arduino-cli.
//
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.

syntax = "proto3";

package cc.arduino.cli.settings;

option go_package = "github.com/arduino/arduino-cli/rpc/settings";

// The Settings service provides an interface to Arduino CLI's configuration
// options
service Settings {
  // List all the settings.
  rpc GetAll(GetAllRequest) returns (RawData);
  // Set multiple settings values at once.
  rpc Merge(RawData) returns (MergeResponse);
  // Get the value of a specific setting.
  rpc GetValue(GetValueRequest) returns (Value);
  // Set the value of a specific setting.
  rpc SetValue(Value) returns (SetValueResponse);
}

message RawData {
    // The settings, in JSON format.
    string jsonData = 1;
}

message Value {
  // The key of the setting.
  string key = 1;
  // The setting, in JSON format.
  string jsonData = 2;
}

message GetAllRequest {}
message GetValueRequest {
  // The key of the setting.
  string key = 1;
}
message MergeResponse {}
message SetValueResponse {}
