syntax = "proto3";

package session;

import "google/api/annotations.proto";

message SessionID {
  string ID = 1;
}

message Session {
  string login = 1;
  string useragent = 2;
}

message Nothing {
  bool dummy = 1;
}

/*
protoc -I/usr/local/include -I. \
  -I$GOPATH/src \
  -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
  --go_out=plugins=grpc:. \
  session.proto
protoc -I/usr/local/include -I. \
  -I$GOPATH/src \
  -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
  --grpc-gateway_out=logtostderr=true:. \
  session.proto
protoc -I/usr/local/include -I. \
  -I$GOPATH/src \
  -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
  --swagger_out=logtostderr=true:. \
  session.proto
*/

// grpc-сервис проверки авторизации
service AuthChecker {
    rpc Create (Session) returns (SessionID) {
      option (google.api.http) = {
        post: "/v1/session/create"
        body: "*"
      };
    }
    rpc Check (SessionID) returns (Session) {
      option (google.api.http) = {
        get: "/v1/session/check/{ID}"
      };
    }
    rpc Delete (SessionID) returns (Nothing) {
      option (google.api.http) = {
        post: "/v1/session/delete"
        body: "*"
      };
    }
}

