syntax = "proto2";

package wix.api;

import "google/protobuf/descriptor.proto";

option java_multiple_files = true;
option java_outer_classname = "PermissionsProto";
option java_package = "com.wix.api";

/**
* Annotation for method permission rules
* example usage:
* import "wix/api/permissions.proto";
* service Bloop {
*    rpc Create (CreateBloopRequest) returns (CreateBloopResponse) {
*        option (wix.api.permission).name = "SOME_PERMISSION_NAME";
*    }
*    rpc SpecialDelete (SpecialDeleteBloopRequest) returns (SpecialDeleteResponse) {
*        option (wix.api.permission) = {
*           name: "SOME_PERMISSION_NAME"
*           type: MANUAL
*        }
*    }
* }
**/
extend google.protobuf.MethodOptions {
    optional PermissionRule permission = 50301;
    repeated PermissionRule additional_permission = 50302;
}

message PermissionRule {
  optional string name = 1;
  optional PermissionType type = 2;
  optional AbacRequestValidationMode abac_request_validation = 3;
}

enum PermissionType {
    AUTO = 0;
    MANUAL = 1;
}

enum AbacRequestValidationMode {
  ON = 0;
  OFF = 1;
}
