syntax = "proto3";

package userrole;

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.UserRole";

service UserRoleContract
{
    rpc CreateNewUserRole(CreateNewUserRoleRequest) returns (CreateNewUserRoleResponse){
        option (google.api.http) = {
            post: "/CreateNewUserRole"
            body: "*"
        };
    };
    rpc UpdateUserRole(UpdateUserRoleRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            put: "/UpdateUserRole"
            body: "*"
        };
    };
    rpc DeleteUserRole(DeleteUserRoleRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: "/DeleteUserRole"
            body: "*"
        };
    };
    rpc GetUserRole(GetUserRoleRequest) returns (GetUserRoleResponse){
        option (google.api.http) = {
            get: "/GetUserRole"
            
        };
    };
    rpc GetAllUserRoleByFilter(GetAllUserRoleByFilterRequest) returns (GetAllUserRoleByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllUserRoleByFilter"
            
        };
    };
}
message CreateNewUserRoleRequest
{
    int64 role_id = 1;
    int64 user_id = 2;
}
message CreateNewUserRoleResponse
{
    int64 id = 1;
}
message UpdateUserRoleRequest
{
    int64 id = 1;
    int64 role_id = 2;
    int64 user_id = 3;
}
message DeleteUserRoleRequest
{
    int64 id = 1;
}
message GetUserRoleRequest
{
    int64 id = 1;
}
message GetUserRoleResponse
{
    int64 id = 1;
    int64 role_id = 2;
    int64 user_id = 3;
}
message GetAllUserRoleByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllUserRoleByFilterFilter filter = 3;
}
message GetAllUserRoleByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.Int64Value role_id = 2;
    google.protobuf.Int64Value user_id = 3;
}
message GetAllUserRoleByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllUserRoleByFilterResponseModel models = 2;
}
message GetAllUserRoleByFilterResponseModel
{
    int64 id = 1;
    int64 role_id = 2;
    int64 user_id = 3;
}
