syntax = "proto3";

package blogpostimage;

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

service BlogPostImageContract
{
    rpc AddBlogPostImage(AddBlogPostImageRequest) returns (AddBlogPostImageResponse){
        option (google.api.http) = { post: "/AddBlogPostImage" body: "*" };
    };
    rpc DeleteBlogPostImage(DeleteBlogPostImageRequest) returns (google.protobuf.Empty){
        option (google.api.http) = { delete: "/DeleteBlogPostImage" body: "*" };
    };
    rpc GetBlogPostImages(GetBlogPostImagesRequest) returns (GetBlogPostImagesResponse){
        option (google.api.http) = { get: "/GetBlogPostImages" };
    };
    rpc ReorderBlogPostImages(ReorderBlogPostImagesRequest) returns (google.protobuf.Empty){
        option (google.api.http) = { put: "/ReorderBlogPostImages" body: "*" };
    };
}

// ── Add ──
message AddBlogPostImageRequest
{
    int64 blog_post_id = 1;
    string image_path = 2;
    string thumbnail_path = 3;
    google.protobuf.StringValue alt_text = 4;
    google.protobuf.StringValue caption = 5;
    int32 sort_order = 6;
}
message AddBlogPostImageResponse
{
    int64 id = 1;
}

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

// ── Get All for Post ──
message GetBlogPostImagesRequest
{
    int64 blog_post_id = 1;
}
message GetBlogPostImagesResponse
{
    repeated BlogPostImageItem images = 1;
}
message BlogPostImageItem
{
    int64 id = 1;
    int64 blog_post_id = 2;
    string image_path = 3;
    string thumbnail_path = 4;
    google.protobuf.StringValue alt_text = 5;
    google.protobuf.StringValue caption = 6;
    int32 sort_order = 7;
}

// ── Reorder ──
message ReorderBlogPostImagesRequest
{
    repeated ImageSortItem items = 1;
}
message ImageSortItem
{
    int64 id = 1;
    int32 sort_order = 2;
}
