syntax = "proto3";

package configservices;

import "core/api/grpc/common.proto";

message ConfigServiceConfig {
    int32 node_id = 1;
    string name = 2;
    map<string, string> templates = 3;
    map<string, string> config = 4;
}

message ConfigServiceValidationMode {
    enum Enum {
        BLOCKING = 0;
        NON_BLOCKING = 1;
        TIMER = 2;
    }
}

message ConfigService {
    string group = 1;
    string name = 2;
    repeated string executables = 3;
    repeated string dependencies = 4;
    repeated string directories = 5;
    repeated string files = 6;
    repeated string startup = 7;
    repeated string validate = 8;
    repeated string shutdown = 9;
    ConfigServiceValidationMode.Enum validation_mode = 10;
    int32 validation_timer = 11;
    float validation_period = 12;
}

message ConfigMode {
    string name = 1;
    map<string, string> config = 2;
}

message GetConfigServicesRequest {
    int32 session_id = 1;
}

message GetConfigServicesResponse {
    repeated ConfigService services = 1;
}

message GetConfigServiceDefaultsRequest {
    string name = 1;
}

message GetConfigServiceDefaultsResponse {
    map<string, string> templates = 1;
    map<string, common.ConfigOption> config = 2;
    repeated ConfigMode modes = 3;
}

message GetNodeConfigServiceConfigsRequest {
    int32 session_id = 1;
}

message GetNodeConfigServiceConfigsResponse {
    repeated ConfigServiceConfig configs = 1;
}

message GetNodeConfigServiceRequest {
    int32 session_id = 1;
    int32 node_id = 2;
    string name = 3;
}

message GetNodeConfigServiceResponse {
    map<string, string> config = 1;
}

message GetNodeConfigServicesRequest {
    int32 session_id = 1;
    int32 node_id = 2;
}

message GetNodeConfigServicesResponse {
    repeated string services = 1;
}

message SetNodeConfigServiceRequest {
    int32 session_id = 1;
    int32 node_id = 2;
    string name = 3;
    map<string, string> config = 4;
}

message SetNodeConfigServiceResponse {
    bool result = 1;
}
