// M-Files Server gRPC API 26.11. Generated from the M-Files Server IDL; do not edit.
// Documentation: https://developer.m-files.com/APIs/gRPC-API/
syntax = "proto3";

package MFiles;

import "mfiles/api/annotations.proto";
import "mfiles/structs.proto";

option csharp_namespace = "MFiles.Grpc";
option go_package = "github.com/M-Files/mfiles-grpc-api/go/mfiles;mfiles";
option java_multiple_files = true;
option java_package = "com.mfiles.grpc";
option objc_class_prefix = "MF_";

// Reads and replaces the whole metadata structure of a vault as one typed message. Preview feature,
// off by default; for the declarative configuration converter.
//
// **For M-Files components only.** It is meant for the declarative configuration converter that
// is installed with M-Files Server, which reads and deploys the vault's structure through it.
// Applications should not call it.
//
// - **Not available by default.** On a server where the declarative metadata structure feature is
//   not enabled, every method fails with "Not implemented." (gRPC status `UNKNOWN`, error code
//   0x80004001) before any rights check.
//   [SetDeclarativeMetadataStructureBeginSessionAsProtobuf](mfiles:MFiles.IRPCDeclarativeMetadataStructureAsProtobuf.SetDeclarativeMetadataStructureBeginSessionAsProtobuf)
//   and
//   [SetDeclarativeMetadataStructureEndSessionAsProtobuf](mfiles:MFiles.IRPCDeclarativeMetadataStructureAsProtobuf.SetDeclarativeMetadataStructureEndSessionAsProtobuf)
//   are not implemented even when it is on.
// - **Relation to the JSON service.** This service exchanges the structure as a
//   [DeclarativeMetadataStructure](mfiles:MFiles.DeclarativeMetadataStructure) message that uses the
//   vault's IDs. [IRPCDeclarativeMetadataStructure](mfiles:MFiles.IRPCDeclarativeMetadataStructure)
//   exchanges the same structure as a declarative JSON document in which elements refer to each
//   other by name; the server converts between the two forms. See that service for the format.
// - **Session and rights.** Every method requires a vault session and the vault right
//   `change_metadata_structure`, reads included.
// - Every method sends the `mfiles-metadata-version-bin` trailer when it succeeds.
service IRPCDeclarativeMetadataStructureAsProtobuf {
	option (mfiles.api.service) = { book: "admin" level: LEVEL_SPECIALIZED title: "Declarative metadata structure (protobuf)" };

	// Gets the vault's current metadata structure as one typed message.
	//
	// - Fails with "Not implemented." unless the feature is enabled on the server.
	// - Requires `change_metadata_structure`.
	// - Always returns the current structure: the server does not read `revision`.
	// - `mds.revision` is the revision to send back with
	//   [SetDeclarativeMetadataStructureAsProtobuf](mfiles:MFiles.IRPCDeclarativeMetadataStructureAsProtobuf.SetDeclarativeMetadataStructureAsProtobuf).
	rpc GetDeclarativeMetadataStructureAsProtobuf( GetDeclarativeMetadataStructureAsProtobufRequest ) returns ( GetDeclarativeMetadataStructureAsProtobufResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION returns_metadata_structure_version: true internal: true };
	}

	// Replaces the vault's metadata structure with the given structure.
	//
	// - Fails with "Not implemented." unless deploying declarative structures is enabled on the server.
	// - Requires `change_metadata_structure`.
	// - `mds.revision` must be the vault's current revision, as returned by
	//   [GetDeclarativeMetadataStructureAsProtobuf](mfiles:MFiles.IRPCDeclarativeMetadataStructureAsProtobuf.GetDeclarativeMetadataStructureAsProtobuf);
	//   otherwise the call fails. Failures are reported as "Setting the declarative metadata structure
	//   failed." without further detail.
	rpc SetDeclarativeMetadataStructureAsProtobuf( SetDeclarativeMetadataStructureAsProtobufRequest ) returns ( SetDeclarativeMetadataStructureAsProtobufResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION returns_metadata_structure_version: true internal: true };
	}

	// Reserved for setting a structure in several parts. Not implemented.
	//
	// - Always fails with "Not implemented.", whether or not the feature is enabled.
	rpc SetDeclarativeMetadataStructureBeginSessionAsProtobuf( SetDeclarativeMetadataStructureBeginSessionAsProtobufRequest ) returns ( SetDeclarativeMetadataStructureBeginSessionAsProtobufResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION returns_metadata_structure_version: true internal: true };
	}

	// Reserved for setting a structure in several parts. Not implemented.
	//
	// - Always fails with "Not implemented.", whether or not the feature is enabled.
	rpc SetDeclarativeMetadataStructureEndSessionAsProtobuf( SetDeclarativeMetadataStructureEndSessionAsProtobufRequest ) returns ( SetDeclarativeMetadataStructureEndSessionAsProtobufResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION returns_metadata_structure_version: true internal: true };
	}
}

// The request of GETDECLARATIVEMETADATASTRUCTUREASPROTOBUF.
message GetDeclarativeMetadataStructureAsProtobufRequest {

	// Not used by the server; the current structure is returned.
	int32 revision = 1;
}

// The response of GETDECLARATIVEMETADATASTRUCTUREASPROTOBUF.
message GetDeclarativeMetadataStructureAsProtobufResponse {

	// The complete metadata structure.
	DeclarativeMetadataStructure mds = 1;

	// The vault's metadata structure version that the structure belongs to.
	int32 mdver = 2;

	// The server that produced the structure, as `M-Files.<version>`.
	string writer_info = 3;
}

// The request of SETDECLARATIVEMETADATASTRUCTUREASPROTOBUF.
message SetDeclarativeMetadataStructureAsProtobufRequest {

	// Not used by the server. Leave 0.
	uint32 session = 1;

	// The complete new metadata structure.
	DeclarativeMetadataStructure mds = 2;

	// Not read by the server.
	repeated MetadataStructureAnomaly anomalies = 3;
}

// The response of SETDECLARATIVEMETADATASTRUCTUREASPROTOBUF.
message SetDeclarativeMetadataStructureAsProtobufResponse {
}

// The request of SETDECLARATIVEMETADATASTRUCTUREBEGINSESSIONASPROTOBUF.
message SetDeclarativeMetadataStructureBeginSessionAsProtobufRequest {
}

// The response of SETDECLARATIVEMETADATASTRUCTUREBEGINSESSIONASPROTOBUF.
message SetDeclarativeMetadataStructureBeginSessionAsProtobufResponse {

	// Session identifier.
	uint32 session = 1;
}

// The request of SETDECLARATIVEMETADATASTRUCTUREENDSESSIONASPROTOBUF.
message SetDeclarativeMetadataStructureEndSessionAsProtobufRequest {

	// Session identifier.
	uint32 session = 1;

	// True to commit the Set operation.
	bool commit = 2;
}

// The response of SETDECLARATIVEMETADATASTRUCTUREENDSESSIONASPROTOBUF.
message SetDeclarativeMetadataStructureEndSessionAsProtobufResponse {
}
