syntax = "proto3";

package user.v1;

message User {
  int64 id = 1;
  string username = 2;
  optional int64 profile_picture_id = 3;
}

service UserService {
  rpc GetUser (GetUserRequest) returns (GetUserResponse) {}
  rpc UpdatePassword (UpdatePasswordRequest) returns (UpdatePasswordResponse) {}
  rpc GetAPIKey (GetAPIKeyRequest) returns (GetAPIKeyResponse) {}
  rpc UpdateProfilePicture (UpdateProfilePictureRequest) returns (UpdateProfilePictureResponse) {}

  rpc BeginPasskeyRegistration (BeginPasskeyRegistrationRequest) returns (BeginPasskeyRegistrationResponse) {}
  rpc FinishPasskeyRegistration (FinishPasskeyRegistrationRequest) returns (FinishPasskeyRegistrationResponse) {}
}

message GetUserRequest {}
message GetUserResponse {
  User user = 1;
}

message UpdatePasswordRequest {
  string old_password = 1;
  string new_password = 2;
  string confirm_password = 3;
}
message UpdatePasswordResponse {
  User user = 1;
}

message GetAPIKeyRequest {
  string password = 1;
  string confirm_password = 2;
}
message GetAPIKeyResponse { 
  string key = 1;
}

message UpdateProfilePictureRequest {
  string file_name = 1;
  bytes data = 2;
}
message UpdateProfilePictureResponse {
  User user = 1;
}

message BeginPasskeyRegistrationRequest {}
message BeginPasskeyRegistrationResponse {
  string options_json = 1;
}

message FinishPasskeyRegistrationRequest {
  string attestation = 1;
}
message FinishPasskeyRegistrationResponse {}

// message BeginPasskeyRegistrationRequest {}
// message BeginPasskeyRegistrationResponse {}

// message FinishPasskeyRegistrationRequest {}
// message FinishPasskeyRegistrationResponse {}