// 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.media;

import "anki/generic.proto";
import "anki/notetypes.proto";

service MediaService {
  rpc CheckMedia(generic.Empty) returns (CheckMediaResponse);
  rpc AddMediaFile(AddMediaFileRequest) returns (generic.String);
  rpc TrashMediaFiles(TrashMediaFilesRequest) returns (generic.Empty);
  rpc EmptyTrash(generic.Empty) returns (generic.Empty);
  rpc RestoreTrash(generic.Empty) returns (generic.Empty);
  rpc ExtractStaticMediaFiles(notetypes.NotetypeId)
      returns (generic.StringList);
}

// Implicitly includes any of the above methods that are not listed in the
// backend service.
service BackendMediaService {}

message CheckMediaResponse {
  repeated string unused = 1;
  repeated string missing = 2;
  repeated int64 missing_media_notes = 3;
  string report = 4;
  bool have_trash = 5;
}

message TrashMediaFilesRequest {
  repeated string fnames = 1;
}

message AddMediaFileRequest {
  string desired_name = 1;
  bytes data = 2;
}
