syntax = "proto3";

package otptoken;

import "public_messages.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.OtpToken";

service OtpTokenContract
{
    rpc CreateNewOtpToken(CreateNewOtpTokenRequest) returns (CreateNewOtpTokenResponse){
        option (google.api.http) = {
            post: "/CreateNewOtpToken"
            body: "*"
        };
    };
    rpc VerifyOtpToken(VerifyOtpTokenRequest) returns (VerifyOtpTokenResponse){
        option (google.api.http) = {
            post: "/VerifyOtpToken"
            body: "*"
        };
    };
    rpc GetAllOtpTokenByFilter(GetAllOtpTokenByFilterRequest) returns (GetAllOtpTokenByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllOtpTokenByFilter"
            
        };
    };
}
message CreateNewOtpTokenRequest
{
    string mobile = 1;
    string purpose = 2;
    google.protobuf.StringValue sign_guid = 3;
}
message CreateNewOtpTokenResponse
{
    bool success = 1;
    string message = 2;
    google.protobuf.StringValue code = 3;
    int32 remaining_attempts = 4;
    int32 remaining_seconds = 5;
}
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.Int64Value user_id = 3;
    int32 remaining_attempts = 4;
    int32 remaining_seconds = 5;
}
message GetAllOtpTokenByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllOtpTokenByFilterFilter filter = 3;
}
message GetAllOtpTokenByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.StringValue mobile = 2;
    google.protobuf.StringValue purpose = 3;
    google.protobuf.StringValue code_hash = 4;
    google.protobuf.Timestamp expires_at = 5;
    google.protobuf.Int32Value attempts = 6;
    google.protobuf.BoolValue is_used = 7;
}
message GetAllOtpTokenByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllOtpTokenByFilterResponseModel models = 2;
}
message GetAllOtpTokenByFilterResponseModel
{
    int64 id = 1;
    string mobile = 2;
    string purpose = 3;
    string code_hash = 4;
    google.protobuf.Timestamp expires_at = 5;
    int32 attempts = 6;
    bool is_used = 7;
}
