syntax = "proto3";

package blogcategory;

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

service BlogCategoryContract
{
    rpc CreateBlogCategory(CreateBlogCategoryRequest) returns (CreateBlogCategoryResponse){
        option (google.api.http) = { post: "/CreateBlogCategory" body: "*" };
    };
    rpc UpdateBlogCategory(UpdateBlogCategoryRequest) returns (google.protobuf.Empty){
        option (google.api.http) = { put: "/UpdateBlogCategory" body: "*" };
    };
    rpc DeleteBlogCategory(DeleteBlogCategoryRequest) returns (google.protobuf.Empty){
        option (google.api.http) = { delete: "/DeleteBlogCategory" body: "*" };
    };
    rpc GetBlogCategory(GetBlogCategoryRequest) returns (GetBlogCategoryResponse){
        option (google.api.http) = { get: "/GetBlogCategory" };
    };
    rpc GetAllBlogCategories(GetAllBlogCategoriesRequest) returns (GetAllBlogCategoriesResponse){
        option (google.api.http) = { get: "/GetAllBlogCategories" };
    };
    rpc GetActiveBlogCategories(GetActiveBlogCategoriesRequest) returns (GetActiveBlogCategoriesResponse){
        option (google.api.http) = { get: "/GetActiveBlogCategories" };
    };
}

// ── Create ──
message CreateBlogCategoryRequest
{
    string title = 1;
    string slug = 2;
    google.protobuf.StringValue description = 3;
    google.protobuf.StringValue icon_name = 4;
    int32 sort_order = 5;
    bool is_active = 6;
}
message CreateBlogCategoryResponse
{
    int64 id = 1;
}

// ── Update ──
message UpdateBlogCategoryRequest
{
    int64 id = 1;
    string title = 2;
    string slug = 3;
    google.protobuf.StringValue description = 4;
    google.protobuf.StringValue icon_name = 5;
    int32 sort_order = 6;
    bool is_active = 7;
}

// ── Delete ──
message DeleteBlogCategoryRequest
{
    int64 id = 1;
}

// ── Get ──
message GetBlogCategoryRequest
{
    int64 id = 1;
}
message GetBlogCategoryResponse
{
    int64 id = 1;
    string title = 2;
    string slug = 3;
    google.protobuf.StringValue description = 4;
    google.protobuf.StringValue icon_name = 5;
    int32 sort_order = 6;
    bool is_active = 7;
    int32 post_count = 8;
    google.protobuf.Timestamp created = 9;
}

// ── Get All (Admin) ──
message GetAllBlogCategoriesRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
}
message GetAllBlogCategoriesResponse
{
    messages.MetaData meta_data = 1;
    repeated BlogCategoryListItem models = 2;
}
message BlogCategoryListItem
{
    int64 id = 1;
    string title = 2;
    string slug = 3;
    google.protobuf.StringValue description = 4;
    google.protobuf.StringValue icon_name = 5;
    int32 sort_order = 6;
    bool is_active = 7;
    int32 post_count = 8;
}

// ── Get Active (Customer) ──
message GetActiveBlogCategoriesRequest {}
message GetActiveBlogCategoriesResponse
{
    repeated BlogCategoryListItem categories = 1;
}
