syntax = "proto3";

package gosdn.app;

import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/app";

service AppService {

    // Allows the registration of an application in order to use it with the controller.
    rpc Register(AppRegisterRequest) returns (AppRegisterResponse) {
        option (google.api.http) = {
            post: "/register"
            body: "*"
        };
    }

    // Allows the deregistration of an application that is currently registered to the controller.
    rpc Deregister(AppDeregisterRequest) returns (AppDeregisterResponse) {
        option (google.api.http) = {
            post: "/deregister"
            body: "*"
        };
    }
}

enum Status {
    STATUS_UNSPECIFIED = 0;
    STATUS_OK = 1;
    STATUS_ERROR = 2;
}

message AppRegisterRequest {
    int64 timestamp = 1;
    string appname = 2;
    string token = 3;
}

message AppRegisterResponse {
    int64 timestamp = 1;
    Status status = 2;
    string queueconnection = 3;
}

message AppDeregisterRequest {
    int64 timestamp = 1;
    string appname = 2;
}

message AppDeregisterResponse {
    int64 timestamp = 1;
    Status status = 2;
}
