syntax = "proto3";

package auth;

// Auth service for token and authentication testing
service AuthService {
  // Login and get tokens
  rpc Login(LoginRequest) returns (LoginResponse);
  
  // Validate access token
  rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
  
  // Refresh access token
  rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse);
  
  // Logout and invalidate tokens
  rpc Logout(LogoutRequest) returns (LogoutResponse);
}

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

message LoginResponse {
  string access_token = 1;
  string refresh_token = 2;
  int64 expires_in = 3;
  string token_type = 4;
}

message ValidateTokenRequest {
  string access_token = 1;
}

message ValidateTokenResponse {
  bool valid = 1;
  string user_id = 2;
  int64 expires_at = 3;
}

message RefreshTokenRequest {
  string refresh_token = 1;
}

message RefreshTokenResponse {
  string access_token = 1;
  int64 expires_in = 2;
}

message LogoutRequest {
  string access_token = 1;
}

message LogoutResponse {
  bool success = 1;
}
