syntax = "proto3";

package role;

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

service RoleContract
{
    rpc CreateNewRole(CreateNewRoleRequest) returns (CreateNewRoleResponse){
        option (google.api.http) = {
            post: "/CreateNewRole"
            body: "*"
        };
    };
    rpc UpdateRole(UpdateRoleRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            put: "/UpdateRole"
            body: "*"
        };
    };
    rpc DeleteRole(DeleteRoleRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: "/DeleteRole"
            body: "*"
        };
    };
    rpc GetRole(GetRoleRequest) returns (GetRoleResponse){
        option (google.api.http) = {
            get: "/GetRole"
            
        };
    };
    rpc GetAllRoleByFilter(GetAllRoleByFilterRequest) returns (GetAllRoleByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllRoleByFilter"
            
        };
    };
}
message CreateNewRoleRequest
{
    string name = 1;
    string title = 2;
}
message CreateNewRoleResponse
{
    int64 id = 1;
}
message UpdateRoleRequest
{
    int64 id = 1;
    string name = 2;
    string title = 3;
}
message DeleteRoleRequest
{
    int64 id = 1;
}
message GetRoleRequest
{
    int64 id = 1;
}
message GetRoleResponse
{
    int64 id = 1;
    string name = 2;
    string title = 3;
}
message GetAllRoleByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllRoleByFilterFilter filter = 3;
}
message GetAllRoleByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.StringValue name = 2;
    google.protobuf.StringValue title = 3;
}
message GetAllRoleByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllRoleByFilterResponseModel models = 2;
}
message GetAllRoleByFilterResponseModel
{
    int64 id = 1;
    string name = 2;
    string title = 3;
}
