syntax = "proto3";

package openspeak.v1;

import "proto/common.proto";

option go_package = "github.com/sorti/openspeak/pkg/api/openspeak/v1";

service AuthService {
  rpc Login(LoginRequest) returns (LoginResponse);
  rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
  rpc GetMyPermissions(GetMyPermissionsRequest) returns (GetMyPermissionsResponse);
}

message LoginRequest {
  string token = 1;
}

message LoginResponse {
  Status status = 1;
  string user_id = 2;
  string session_id = 3;
  repeated string permissions = 4;
  int64 expires_at = 5;
}

message ValidateTokenRequest {
  string token = 1;
}

message ValidateTokenResponse {
  bool valid = 1;
  string user_id = 2;
  repeated string permissions = 3;
}

message GetMyPermissionsRequest {}

message GetMyPermissionsResponse {
  repeated string permissions = 1;
  string user_id = 2;
}
