syntax = "proto3"; package user; import "City.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; option csharp_namespace = "CMSMicroservice.Protobuf.Protos.User"; service UserContract { rpc CreateNewUser(CreateNewUserRequest) returns (CreateNewUserResponse){ option (google.api.http) = { post: "/CreateNewUser" body: "*" }; }; rpc UpdateUser(UpdateUserRequest) returns (google.protobuf.Empty){ option (google.api.http) = { put: "/UpdateUser" body: "*" }; }; rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty){ option (google.api.http) = { delete: "/DeleteUser" body: "*" }; }; rpc GetUser(GetUserRequest) returns (GetUserResponse){ option (google.api.http) = { get: "/GetUser" }; }; rpc GetAllUserByFilter(GetAllUserByFilterRequest) returns (GetAllUserByFilterResponse){ option (google.api.http) = { get: "/GetAllUserByFilter" }; }; rpc GetJwtToken(GetJwtTokenRequest) returns (GetJwtTokenResponse){ option (google.api.http) = { get: "/GetJwtToken" }; }; rpc AdminGetJwtToken(AdminGetJwtTokenRequest) returns (AdminGetJwtTokenResponse){ option (google.api.http) = { get: "/AdminGetJwtToken" }; }; rpc SetPasswordForUser(SetPasswordForUserRequest) returns (google.protobuf.Empty){ option (google.api.http) = { post: "/SetPasswordForUser" body: "*" }; }; rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse){ option (google.api.http) = { post: "/RefreshToken" body: "*" }; }; rpc CreateNewOtpToken(CreateNewOtpTokenRequest) returns (CreateNewOtpTokenResponse){ option (google.api.http) = { post: "/Customer/CreateNewOtpToken" body: "*" }; }; rpc VerifyOtpToken(VerifyOtpTokenRequest) returns (VerifyOtpTokenResponse){ option (google.api.http) = { post: "/Customer/VerifyOtpToken" body: "*" }; }; rpc AcceptContract(AcceptContractRequest) returns (AcceptContractResponse){ option (google.api.http) = { post: "/Customer/AcceptContract" body: "*" }; }; rpc GetUserForCustomer(GetUserForCustomerRequest) returns (GetUserForCustomerResponse){ option (google.api.http) = { get: "/Customer/GetUser" }; }; rpc UpdateCustomerProfile(UpdateCustomerProfileRequest) returns (google.protobuf.Empty){ option (google.api.http) = { put: "/Customer/UpdateProfile" body: "*" }; }; rpc GetCustomerProfile(GetCustomerProfileRequest) returns (GetCustomerProfileResponse){ option (google.api.http) = { get: "/Customer/GetProfile" }; }; rpc ChangeCustomerPassword(ChangeCustomerPasswordRequest) returns (ChangeCustomerPasswordResponse){ option (google.api.http) = { post: "/Customer/ChangePassword" body: "*" }; }; rpc GetCustomerReferrals(GetCustomerReferralsRequest) returns (GetCustomerReferralsResponse){ option (google.api.http) = { get: "/Customer/GetReferrals" }; }; rpc UploadCustomerAvatar(UploadCustomerAvatarRequest) returns (UploadCustomerAvatarResponse){ option (google.api.http) = { post: "/Customer/UploadAvatar" body: "*" }; }; rpc GetCustomerSettings(GetCustomerSettingsRequest) returns (GetCustomerSettingsResponse){ option (google.api.http) = { get: "/Customer/GetSettings" }; }; rpc UpdateCustomerSettings(UpdateCustomerSettingsRequest) returns (google.protobuf.Empty){ option (google.api.http) = { put: "/Customer/UpdateSettings" body: "*" }; }; } message CreateNewUserRequest { google.protobuf.StringValue first_name = 1; google.protobuf.StringValue last_name = 2; string mobile = 3; google.protobuf.StringValue email = 4; google.protobuf.StringValue national_code = 5; google.protobuf.StringValue avatar_path = 6; google.protobuf.Int64Value parent_id = 7; bool email_notifications = 8; bool sms_notifications = 9; bool push_notifications = 10; google.protobuf.Timestamp birth_date = 11; } message CreateNewUserResponse { int64 id = 1; } message UpdateUserRequest { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; google.protobuf.StringValue email = 4; google.protobuf.StringValue national_code = 5; google.protobuf.StringValue avatar_path = 6; bool is_rules_accepted = 7; google.protobuf.Timestamp rules_accepted_at = 8; bool email_notifications = 9; bool sms_notifications = 10; bool push_notifications = 11; google.protobuf.Timestamp birth_date = 12; } message DeleteUserRequest { int64 id = 1; } message GetUserRequest { int64 id = 1; } message GetUserResponse { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; string mobile = 4; google.protobuf.StringValue email = 5; google.protobuf.StringValue national_code = 6; google.protobuf.StringValue avatar_path = 7; google.protobuf.Int64Value parent_id = 8; string referral_code = 9; bool is_mobile_verified = 10; google.protobuf.Timestamp mobile_verified_at = 11; bool email_notifications = 12; bool sms_notifications = 13; bool push_notifications = 14; google.protobuf.Timestamp birth_date = 15; } message GetAllUserByFilterRequest { city.PaginationState pagination_state = 1; google.protobuf.StringValue sort_by = 2; GetAllUserByFilterFilter filter = 3; } message GetAllUserByFilterFilter { google.protobuf.StringValue search_text = 1; google.protobuf.Int64Value id = 2; google.protobuf.StringValue first_name = 3; google.protobuf.StringValue last_name = 4; google.protobuf.StringValue mobile = 5; google.protobuf.StringValue national_code = 6; google.protobuf.StringValue avatar_path = 7; google.protobuf.Int64Value parent_id = 8; google.protobuf.StringValue referral_code = 9; google.protobuf.BoolValue is_mobile_verified = 10; google.protobuf.Timestamp mobile_verified_at = 11; google.protobuf.BoolValue email_notifications = 12; google.protobuf.BoolValue sms_notifications = 13; google.protobuf.BoolValue push_notifications = 14; google.protobuf.Timestamp birth_date = 15; } message GetAllUserByFilterResponse { city.MetaData meta_data = 1; repeated GetAllUserByFilterResponseModel models = 2; } message GetAllUserByFilterResponseModel { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; string mobile = 4; google.protobuf.StringValue national_code = 5; google.protobuf.StringValue avatar_path = 6; google.protobuf.Int64Value parent_id = 7; string referral_code = 8; bool is_mobile_verified = 9; google.protobuf.Timestamp mobile_verified_at = 10; bool email_notifications = 11; bool sms_notifications = 12; bool push_notifications = 13; google.protobuf.Timestamp birth_date = 14; } message GetJwtTokenRequest { int64 id = 1; } message GetJwtTokenResponse { string token = 1; } message AdminGetJwtTokenRequest { string username = 1; string password = 2; } message AdminGetJwtTokenResponse { string token = 1; } message SetPasswordForUserRequest { int64 user_id = 1; google.protobuf.StringValue current_password = 2; string new_password = 3; string confirm_password = 4; } message RefreshTokenRequest { string current_token = 1; } message RefreshTokenResponse { string token = 1; bool success = 2; string message = 3; } message CreateNewOtpTokenRequest { string mobile = 1; string purpose = 2; google.protobuf.StringValue sign_guid = 3; } message CreateNewOtpTokenResponse { bool success = 1; string message = 2; int32 remaining_attempts = 3; int32 remaining_seconds = 4; } message VerifyOtpTokenRequest { string mobile = 1; string purpose = 2; string code = 3; google.protobuf.StringValue parent_referral_code = 4; } message VerifyOtpTokenResponse { bool success = 1; string message = 2; google.protobuf.StringValue token = 3; int32 remaining_attempts = 4; } message AcceptContractRequest { string code = 1; string contract_html = 2; string sign_guid = 3; } message AcceptContractResponse { string token = 1; } message GetUserForCustomerRequest { // Empty request - user identified by token } message GetUserForCustomerResponse { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; string mobile = 4; google.protobuf.StringValue email = 5; google.protobuf.StringValue national_code = 6; google.protobuf.StringValue avatar_path = 7; google.protobuf.Int64Value parent_id = 8; string referral_code = 9; bool is_mobile_verified = 10; google.protobuf.Timestamp mobile_verified_at = 11; bool email_notifications = 12; bool sms_notifications = 13; bool push_notifications = 14; google.protobuf.Timestamp birth_date = 15; string token = 16; // JWT token for authentication refresh } // ============= Customer Profile Messages ============= message UpdateCustomerProfileRequest { google.protobuf.StringValue first_name = 1; google.protobuf.StringValue last_name = 2; google.protobuf.StringValue email = 3; google.protobuf.StringValue national_code = 4; google.protobuf.Timestamp birth_date = 5; } message GetCustomerProfileRequest { // Empty request - user identified by token } message GetCustomerProfileResponse { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; string mobile = 4; google.protobuf.StringValue email = 5; google.protobuf.StringValue national_code = 6; google.protobuf.StringValue avatar_path = 7; google.protobuf.Int64Value parent_id = 8; string referral_code = 9; bool is_mobile_verified = 10; google.protobuf.Timestamp mobile_verified_at = 11; bool email_notifications = 12; bool sms_notifications = 13; bool push_notifications = 14; google.protobuf.Timestamp birth_date = 15; string full_name = 16; int32 profile_completion_percentage = 17; } message ChangeCustomerPasswordRequest { string current_password = 1; string new_password = 2; string confirm_password = 3; } message ChangeCustomerPasswordResponse { bool success = 1; string message = 2; } // ============= Customer Referrals Messages ============= message GetCustomerReferralsRequest { city.PaginationState pagination_state = 1; google.protobuf.StringValue status_filter = 2; // ACTIVE, INACTIVE, ALL } message GetCustomerReferralsResponse { city.MetaData meta_data = 1; repeated CustomerReferralModel referrals = 2; CustomerReferralStats stats = 3; } message CustomerReferralModel { int64 id = 1; google.protobuf.StringValue first_name = 2; google.protobuf.StringValue last_name = 3; string mobile = 4; google.protobuf.Timestamp join_date = 5; bool is_active = 6; string status_message = 7; int32 level = 8; int64 total_commission = 9; } message CustomerReferralStats { int32 total_referrals = 1; int32 active_referrals = 2; int64 total_commission_earned = 3; int64 this_month_commission = 4; } // ============= Customer Avatar Messages ============= message UploadCustomerAvatarRequest { string file_name = 1; string file_mime_type = 2; bytes file_data = 3; } message UploadCustomerAvatarResponse { bool success = 1; string message = 2; google.protobuf.StringValue avatar_url = 3; } // ============= Customer Settings Messages ============= message GetCustomerSettingsRequest { // Empty request - user identified by token } message GetCustomerSettingsResponse { bool email_notifications = 1; bool sms_notifications = 2; bool push_notifications = 3; bool marketing_notifications = 4; string preferred_language = 5; string time_zone = 6; bool two_factor_auth_enabled = 7; } message UpdateCustomerSettingsRequest { bool email_notifications = 1; bool sms_notifications = 2; bool push_notifications = 3; bool marketing_notifications = 4; google.protobuf.StringValue preferred_language = 5; google.protobuf.StringValue time_zone = 6; google.protobuf.BoolValue two_factor_auth_enabled = 7; }