syntax = "proto3";

package productcategory;

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

service ProductCategoryContract
{
    rpc CreateNewProductCategory(CreateNewProductCategoryRequest) returns (CreateNewProductCategoryResponse){
        option (google.api.http) = {
            post: "/CreateNewProductCategory"
            body: "*"
        };
    };
    rpc UpdateProductCategory(UpdateProductCategoryRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            put: "/UpdateProductCategory"
            body: "*"
        };
    };
    rpc DeleteProductCategory(DeleteProductCategoryRequest) returns (google.protobuf.Empty){
        option (google.api.http) = {
            delete: "/DeleteProductCategory"
            body: "*"
        };
    };
    rpc GetProductCategory(GetProductCategoryRequest) returns (GetProductCategoryResponse){
        option (google.api.http) = {
            get: "/GetProductCategory"
            
        };
    };
    rpc GetAllProductCategoryByFilter(GetAllProductCategoryByFilterRequest) returns (GetAllProductCategoryByFilterResponse){
        option (google.api.http) = {
            get: "/GetAllProductCategoryByFilter"
            
        };
    };
}
message CreateNewProductCategoryRequest
{
    int64 product_id = 1;
    int64 category_id = 2;
}
message CreateNewProductCategoryResponse
{
    int64 id = 1;
}
message UpdateProductCategoryRequest
{
    int64 id = 1;
    int64 product_id = 2;
    int64 category_id = 3;
}
message DeleteProductCategoryRequest
{
    int64 id = 1;
}
message GetProductCategoryRequest
{
    int64 id = 1;
}
message GetProductCategoryResponse
{
    int64 id = 1;
    int64 product_id = 2;
    int64 category_id = 3;
}
message GetAllProductCategoryByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllProductCategoryByFilterFilter filter = 3;
}
message GetAllProductCategoryByFilterFilter
{
    google.protobuf.Int64Value id = 1;
    google.protobuf.Int64Value product_id = 2;
    google.protobuf.Int64Value category_id = 3;
}
message GetAllProductCategoryByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated GetAllProductCategoryByFilterResponseModel models = 2;
}
message GetAllProductCategoryByFilterResponseModel
{
    int64 id = 1;
    int64 product_id = 2;
    int64 category_id = 3;
}
