syntax = "proto3";

package slash.store;

import "store/common.proto";

option go_package = "gen/store";

message WorkspaceSetting {
  WorkspaceSettingKey key = 1;

  oneof value {
    // The license key of workspace.
    string license_key = 2;
    // The secret session key used to encrypt session data.
    string secret_session = 3;
    // Whether to enable other users to sign up.
    bool enable_signup = 4;
    // The custom style.
    string custom_style = 5;
    // The custom script.
    string custom_script = 6;
    // The auto backup setting. (Unimplemented)
    AutoBackupWorkspaceSetting auto_backup = 7;
    // The instance URL of workspace.
    string instance_url = 8;
    // The default visibility of shortcuts and collections.
    Visibility default_visibility = 9;
    // The url of custom favicon provider. e.g. https://github.com/yourselfhosted/favicons
    string favicon_provider = 10;
  }
}

enum WorkspaceSettingKey {
  WORKSPACE_SETTING_KEY_UNSPECIFIED = 0;
  // The license key.
  WORKSPACE_SETTING_LICENSE_KEY = 1;
  // The secret session key used to encrypt session data.
  WORKSPACE_SETTING_SECRET_SESSION = 2;
  // Whether to enable other users to sign up.
  WORKSAPCE_SETTING_ENABLE_SIGNUP = 3;
  // The custom style.
  WORKSPACE_SETTING_CUSTOM_STYLE = 4;
  // The custom script.
  WORKSPACE_SETTING_CUSTOM_SCRIPT = 5;
  // The auto backup setting.
  WORKSPACE_SETTING_AUTO_BACKUP = 6;
  // The instance URL.
  WORKSPACE_SETTING_INSTANCE_URL = 7;
  // The default visibility of shortcuts and collections.
  WORKSPACE_SETTING_DEFAULT_VISIBILITY = 8;
  // The url of custom favicon provider.
  WORKSPACE_SETTING_FAVICON_PROVIDER = 9;
}

message AutoBackupWorkspaceSetting {
  // Whether auto backup is enabled.
  bool enabled = 1;
  // The cron expression for auto backup.
  // For example, "0 0 0 * * *" means backup at 00:00:00 every day.
  // See https://en.wikipedia.org/wiki/Cron for more details.
  string cron_expression = 2;
  // The maximum number of backups to keep.
  int32 max_keep = 3;
}
