syntax = "proto3";

package metacrypt.v2;

import "google/protobuf/timestamp.proto";

option go_package = "git.wntrmute.dev/mc/metacrypt/gen/metacrypt/v2;metacryptv2";

service AuthService {
  rpc Login(LoginRequest) returns (LoginResponse);
  rpc Logout(LogoutRequest) returns (LogoutResponse);
  rpc TokenInfo(TokenInfoRequest) returns (TokenInfoResponse);
}

message LoginRequest {
  string username = 1;
  string password = 2;
  string totp_code = 3;
}

message LoginResponse {
  string token = 1;
  google.protobuf.Timestamp expires_at = 2;
}

message LogoutRequest {}
message LogoutResponse {}

message TokenInfoRequest {}
message TokenInfoResponse {
  string username = 1;
  repeated string roles = 2;
  bool is_admin = 3;
}
