syntax = "proto3"; package users; option go_package = "git.be.kaien.ru/l-ai/l-ai-core-proto/proto"; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; // UserProfileService manages Telegram user profiles, avatars, and mood history service UserProfileService { rpc GetOrCreateProfile(GetOrCreateProfileRequest) returns (UserProfile); rpc GetProfile(GetProfileRequest) returns (UserProfile); rpc GetAllProfilesWithMessages(google.protobuf.Empty) returns (GetAllProfilesResponse); rpc AddMessageToStats(AddMessageToStatsRequest) returns (google.protobuf.Empty); rpc UpdateReactionCount(UpdateReactionCountRequest) returns (google.protobuf.Empty); rpc SetBotAttitude(SetBotAttitudeRequest) returns (google.protobuf.Empty); rpc SaveMemorableMoment(SaveMemorableMomentRequest) returns (google.protobuf.Empty); rpc GetMemorableMoments(GetMemorableMomentsRequest) returns (GetMemorableMomentsResponse); rpc RecordMoodHistory(RecordMoodHistoryRequest) returns (google.protobuf.Empty); } // UserMoodHistoryService provides mood history queries service UserMoodHistoryService { rpc GetMoodHistoryByUser(GetMoodHistoryByUserRequest) returns (GetMoodHistoryResponse); rpc GetMoodHistoryByTimeRange(GetMoodHistoryByTimeRangeRequest) returns (GetMoodHistoryResponse); rpc GetRecentMoodHistory(GetRecentMoodHistoryRequest) returns (GetMoodHistoryResponse); rpc GetLastMoodBeforeTime(GetLastMoodBeforeTimeRequest) returns (GetMoodHistoryResponse); } // --- Messages --- message UserStats { int64 total_messages = 1; string favorite_topic = 2; string most_active_day = 3; string most_active_hour = 4; string favorite_emoji = 5; double anger_level = 6; double humor_level = 7; double sarcasm_level = 8; map topic_frequency = 9; map messages_by_hour = 10; map messages_by_day = 11; int64 reaction_count = 12; int32 bot_attitude = 13; string bot_attitude_reason = 14; } message UserFavorites { string when_mad = 1; string when_happy = 2; string when_ask_help = 3; string preferred_nick = 4; } message AvatarStats { double strength = 1; double agility = 2; double wisdom = 3; double charisma = 4; double tilt = 5; double humor_level = 6; double sarcasm_lvl = 7; } message Skill { string name = 1; int32 level = 2; double power = 3; bool active = 4; int64 unlocked_at = 5; } message Avatar { int64 id = 1; string name = 2; string class = 3; int32 level = 4; int64 experience = 5; AvatarStats stats = 6; repeated Skill skills = 7; google.protobuf.Timestamp created_at = 8; google.protobuf.Timestamp updated_at = 9; } message UserProfile { int64 id = 1; int64 global_user_id = 2; int64 user_id = 3; string username = 4; google.protobuf.Timestamp join_date = 5; google.protobuf.Timestamp updated_at = 6; Avatar avatar = 7; UserStats stats = 8; UserFavorites favorites = 9; bytes catchphrases = 10; } message UserMoodHistory { int64 id = 1; int64 user_id = 2; string username = 3; int32 mood = 4; google.protobuf.Timestamp timestamp = 5; string reason = 6; } message MemorableMoment { int64 id = 1; int64 user_id = 2; google.protobuf.Timestamp date = 3; string text = 4; string bot_response = 5; int64 reaction_count = 6; } // --- Request/Response messages --- message GetOrCreateProfileRequest { int64 user_id = 1; string username = 2; } message GetProfileRequest { int64 user_id = 1; } message GetAllProfilesResponse { repeated UserProfile profiles = 1; } message AddMessageToStatsRequest { int64 user_id = 1; string topic = 2; string hour = 3; string day = 4; } message UpdateReactionCountRequest { int64 user_id = 1; int64 increment = 2; } message SetBotAttitudeRequest { int64 user_id = 1; int32 value = 2; string reason = 3; bool is_delta = 4; // if true, value is a delta; if false, value is absolute } message SaveMemorableMomentRequest { int64 user_id = 1; string text = 2; string bot_response = 3; int64 reaction_count = 4; } message GetMemorableMomentsRequest { int64 user_id = 1; int32 limit = 2; } message GetMemorableMomentsResponse { repeated MemorableMoment moments = 1; } message RecordMoodHistoryRequest { int64 user_id = 1; string username = 2; int32 mood = 3; string reason = 4; } message GetMoodHistoryByUserRequest { int64 user_id = 1; google.protobuf.Timestamp from = 2; google.protobuf.Timestamp to = 3; } message GetMoodHistoryByTimeRangeRequest { google.protobuf.Timestamp from = 1; google.protobuf.Timestamp to = 2; } message GetRecentMoodHistoryRequest { int32 limit = 1; } message GetLastMoodBeforeTimeRequest { google.protobuf.Timestamp before = 1; } message GetMoodHistoryResponse { repeated UserMoodHistory history = 1; }