syntax = "proto3";

package gosdn.pnd;

import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "github.com/openconfig/gnmi/proto/gnmi/gnmi.proto";
import "gosdn/transport/transport.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

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

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
	info: {
		title: "goSDN Northbound";
    description: "Protocol Buffer specifications and Go code for the goSDN northbound Interface"
		version: "0.1";
		contact: {
			name: "goSDN Northbound project";
			url: "https://code.fbi.h-da.de/danet/api";
			//email: "none@example.com";
		};
		license: {
			name: "BSD 3-Clause License";
			url: "https://code.fbi.h-da.de/danet/api/-/blob/master/LICENSE";
		};
  };
};

service PndService {
  // Allows to request a specific Principal Network Domain.
  rpc GetPnd(GetPndRequest) returns (GetPndResponse) {
    option (google.api.http) = {
      get: "/pnd/{pid}"
    };
  }
  // Allows to request all Principal Network Domains.
  rpc GetPndList(GetPndListRequest) returns (GetPndListResponse) {
    option (google.api.http) = {
      get: "/pnds"
    };
  }
  // Allows create a Principal Network Domain.
  rpc CreatePndList(CreatePndListRequest) returns (CreatePndListResponse) {
    option (google.api.http) = {
      post: "/pnds"
      body: "*"
    };
  }
  // Allows to delete a specific Principal Network Domain.
  rpc DeletePnd(DeletePndRequest) returns (DeletePndResponse) {
    option (google.api.http) = {
      delete: "/pnds/{pid}"
    };
  }
}

message PrincipalNetworkDomain {
    string id = 1;
    string name = 2;
    string description = 3;
}

message GetPndRequest {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    string pid = 2;
}

message GetPndResponse {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    .gosdn.pnd.PrincipalNetworkDomain pnd = 2;
}

message GetPndListRequest {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
}

message GetPndListResponse {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2;
}

message CreatePndListRequest {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    repeated PndCreateProperties pnd = 2;
}

message PndCreateProperties {
    string name = 1;
    string description = 2;
}

message CreatePndListResponse {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    Status status = 2;
}

message DeletePndRequest {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    string pid = 4;
}

message DeletePndResponse {
    int64 timestamp = 1;          // Timestamp in nanoseconds since Epoch.
    Status status = 2;
}

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