syntax = "proto3";

package tag;

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

service TagContract
{
    rpc CreateNewTag(CreateNewTagRequest) returns (CreateNewTagResponse){
        option (google.api.http) = {
            post: "/CreateNewTag"
            body: "*"
        };
    };
    rpc UpdateTag(UpdateTagRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            put: "/UpdateTag"
            body: "*"
        };
    };
    rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: "/DeleteTag"
            body: "*"
        };
    };
    rpc GetTag(GetTagRequest) returns (GetTagResponse){
        option (google.api.http) = {
            get: "/GetTag"
            
        };
    };
    rpc GetAllTagByFilter(GetAllTagByFilterRequest) returns (GetAllTagByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllTagByFilter"
            
        };
    };
    rpc GetProductsByTag(GetProductsByTagRequest) returns (GetProductsByTagResponse){
        option (google.api.http) = {
            get: "/GetProductsByTag"
        };
    };
}
message CreateNewTagRequest
{
    string name = 1;
    string title = 2;
    google.protobuf.StringValue description = 3;
    bool is_active = 4;
    int32 sort_order = 5;
}
message CreateNewTagResponse
{
    int64 id = 1;
}
message UpdateTagRequest
{
    int64 id = 1;
    string name = 2;
    string title = 3;
    google.protobuf.StringValue description = 4;
    bool is_active = 5;
    int32 sort_order = 6;
}
message DeleteTagRequest
{
    int64 id = 1;
}
message GetTagRequest
{
    int64 id = 1;
}
message GetTagResponse
{
    int64 id = 1;
    string name = 2;
    string title = 3;
    google.protobuf.StringValue description = 4;
    bool is_active = 5;
    int32 sort_order = 6;
}
message GetAllTagByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllTagByFilterFilter filter = 3;
}
message GetAllTagByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.StringValue name = 2;
    google.protobuf.StringValue title = 3;
    google.protobuf.StringValue description = 4;
    google.protobuf.BoolValue is_active = 5;
    google.protobuf.Int32Value sort_order = 6;
}
message GetAllTagByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllTagByFilterResponseModel models = 2;
}
message GetAllTagByFilterResponseModel
{
    int64 id = 1;
    string name = 2;
    string title = 3;
    google.protobuf.StringValue description = 4;
    bool is_active = 5;
    int32 sort_order = 6;
}
message GetProductsByTagRequest
{
    int64 tag_id = 1;
}
message GetProductsByTagResponse
{
    repeated ProductSimpleModel products = 1;
}
message ProductSimpleModel
{
    int64 id = 1;
    string title = 2;
    int64 price = 3;
    int32 inventory = 4;
    bool is_active = 5;
    google.protobuf.StringValue image_path = 6;
}
