// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.support.v2beta;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/support/v2beta/feed_item.proto";

option csharp_namespace = "Google.Cloud.Support.V2Beta";
option go_package = "cloud.google.com/go/support/apiv2beta/supportpb;supportpb";
option java_multiple_files = true;
option java_outer_classname = "FeedServiceProto";
option java_package = "com.google.cloud.support.v2beta";
option php_namespace = "Google\\Cloud\\Support\\V2beta";
option ruby_package = "Google::Cloud::Support::V2beta";

// A service to view case feed items.
service FeedService {
  option (google.api.default_host) = "cloudsupport.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Show items in the feed of this case, including case emails,
  // attachments, and comments.
  rpc ShowFeed(ShowFeedRequest) returns (ShowFeedResponse) {
    option (google.api.http) = {
      get: "/v2beta/{parent=projects/*/cases/*}:showFeed"
      additional_bindings {
        get: "/v2beta/{parent=organizations/*/cases/*}:showFeed"
      }
    };
    option (google.api.method_signature) = "parent";
  }
}

// The request message for the ShowFeed endpoint.
message ShowFeedRequest {
  // Required. The resource name of the case for which feed items should be
  // listed.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "cloudsupport.googleapis.com/Case"
    }
  ];

  // Optional. Field to order feed items by, followed by `asc` or `desc`
  // postfix. The only valid field is
  // `creation_time`. This list is case-insensitive, default sorting order is
  // ascending, and the redundant space characters are insignificant.
  //
  // Example: `creation_time desc`
  string order_by = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The maximum number of feed items fetched with each request.
  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying the page of results to return. If
  // unspecified, it retrieves the first page.
  string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
}

// The response message for the ShowFeed endpoint.
message ShowFeedResponse {
  // The list of feed items associated with the given Case.
  repeated FeedItem feed_items = 1;

  // A token to retrieve the next page of results. This should be set in the
  // `page_token` field of subsequent `ShowFeedRequests`.
  // If unspecified, there are no more results to retrieve.
  string next_page_token = 2;
}
