syntax = "proto3";

package mesh.v1;

import "mesh/v1/git_model.proto";
import "mesh/v1/stream.proto";

option go_package = "atlassian.com/bitbucket/mesh/rpc/v1";
option java_multiple_files = true;
option java_outer_classname = "GitDataProtos";
option java_package = "com.atlassian.bitbucket.mesh.rpc.v1";

message RpcUploadFileFragment {
  oneof request_oneof {
    RpcUploadFileRequest request = 1;
    RpcStreamChunk chunk = 2;
  }
}

message RpcUploadFileRequest {
  string repository = 1;
  RpcUploadType type = 2;

  RpcOsFile file = 3;
}

message RpcUploadFileResponse {
  bool want = 1;
}

message RpcUploadFileStart {
  bytes path = 1;
}

message RpcUploadFilesFragment {
  oneof request_oneof {
    RpcUploadFilesRequest request = 1;
    RpcUploadFileStart file_start = 2;
    RpcStreamChunk chunk = 3;
  }
}

message RpcUploadFilesRequest {
  string repository = 1;
  RpcUploadType type = 2;

  repeated RpcOsFile files = 3;
}

message RpcUploadFilesResponse {
  repeated bytes want_paths = 1;
}

message RpcUploadPackFileFragment {
  oneof request_oneof {
    RpcUploadPackFileRequest request = 1;
    RpcStreamChunk chunk = 2;
  }
}

message RpcUploadPackFileRequest {
  string repository = 1;
  RpcGitTimeouts timeouts = 2;
}

message RpcUploadPackFileResponse {
}

enum RpcUploadType {
  UPLOAD_TYPE_UNSPECIFIED = 0;

  UPLOAD_TYPE_GIT_DARK_REFS = 1;
  UPLOAD_TYPE_GIT_LFS = 2;
  UPLOAD_TYPE_GIT_LOG = 3;
  UPLOAD_TYPE_GIT_OBJECTS = 4;
  UPLOAD_TYPE_GIT_REFS = 5;
  UPLOAD_TYPE_GIT_ROOT = 6;
}
