syntax = "proto3";

package devvit.plugin.settings.v1alpha;

import "devvit/ui/form_builder/v1alpha/value.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.snooguts.net/reddit/reddit-devplatform-monorepo/go-common/generated/protos/types/devvit/plugin/settings";
option java_package = "com.reddit.devvit.plugin.settings";

message SettingsValues {
  string version = 1; // a unique identifier for this version of the settings
  map<string, devvit.ui.form_builder.v1alpha.FormFieldValue> settings = 2; // A map of the settings values, field_id:value
  google.protobuf.Timestamp timestamp = 3; // timestamp of when settings were modified
}

message SettingsRequest {}

message SettingsResponse {
  // Defined via InstallationSettings interface; the values of the settings
  SettingsValues installation_settings = 1;

  // Defined via InstanceSettings interface; the values of the settings
  SettingsValues instance_settings = 2;

  // Defined via AppSettings interface; the values of the settings
  SettingsValues app_settings = 3;
}

service Settings {
  // Returns the installation and instance settings
  rpc GetSettings(SettingsRequest) returns (SettingsResponse);
}
