syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.framework.hooks;

import "wix/api/annotations.proto";
import "wix/api/validations.proto";

option java_package = "com.wixpress.appservice.api.upstream.wix.framework.hooks";

message GenericHooksConfig {
    option (.wix.api.decomposite_of) = "wix.framework.hooks.GenericHooksConfig";
    // Hook definitions
    repeated GenericHookConfig hooks = 1 [(.wix.api.maxSize) = 100];

    message GenericHookConfig {
        option (.wix.api.decomposite_of) = "wix.framework.hooks.GenericHooksConfig.GenericHookConfig";
        // FQN of proto service
        string service_fqn = 1;
        // Name of RPC inside given proto service
        string method_name = 2;

        // An URI, which uniquely identifies the hook for invocation
        string uri = 3 [(.wix.api.format) = WEB_URL];

        // Type of hook
        HookType hook_type = 4;
        enum HookType {
            UNDEFINED = 0;
            BEFORE_BLOCKING = 1;
            BEFORE = 2;
            AFTER = 3;
        }
    }
}
