// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html

syntax = "proto3";

option java_multiple_files = true;

package anki.backend;

import "anki/links.proto";

message BackendInit {
  repeated string preferred_langs = 1;
  string locale_folder_path = 2;
  bool server = 3;
}

message I18nBackendInit {
  repeated string preferred_langs = 4;
  string locale_folder_path = 5;
}

message BackendError {
  enum Kind {
    INVALID_INPUT = 0;
    UNDO_EMPTY = 1;
    INTERRUPTED = 2;
    TEMPLATE_PARSE = 3;
    IO_ERROR = 4;
    DB_ERROR = 5;
    NETWORK_ERROR = 6;
    SYNC_AUTH_ERROR = 7;
    SYNC_SERVER_MESSAGE = 23;
    SYNC_OTHER_ERROR = 8;
    JSON_ERROR = 9;
    PROTO_ERROR = 10;
    NOT_FOUND_ERROR = 11;
    EXISTS = 12;
    FILTERED_DECK_ERROR = 13;
    SEARCH_ERROR = 14;
    CUSTOM_STUDY_ERROR = 15;
    IMPORT_ERROR = 16;
    DELETED = 17;
    CARD_TYPE_ERROR = 18;
    ANKIDROID_PANIC_ERROR = 19;
    // Originated from and usually specific to the OS.
    OS_ERROR = 20;
    SCHEDULER_UPGRADE_REQUIRED = 21;
    INVALID_CERTIFICATE_FORMAT = 22;
  }

  // error description, usually localized, suitable for displaying to the user
  string message = 1;
  // the error subtype
  Kind kind = 2;
  // optional page in the manual
  optional links.HelpPageLinkRequest.HelpPage help_page = 3;
  // additional information about the context in which the error occurred
  string context = 4;
  // a backtrace of the underlying error; requires RUST_BACKTRACE to be set
  string backtrace = 5;
}
