// 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.geminidataanalytics.v1alpha;

import "google/api/field_behavior.proto";
import "google/api/field_info.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.GeminiDataAnalytics.V1Alpha";
option go_package = "cloud.google.com/go/geminidataanalytics/apiv1alpha/geminidataanalyticspb;geminidataanalyticspb";
option java_multiple_files = true;
option java_outer_classname = "ConversationProto";
option java_package = "com.google.cloud.geminidataanalytics.v1alpha";
option php_namespace = "Google\\Cloud\\GeminiDataAnalytics\\V1alpha";
option ruby_package = "Google::Cloud::GeminiDataAnalytics::V1alpha";

// Message for a conversation.
message Conversation {
  option (google.api.resource) = {
    type: "geminidataanalytics.googleapis.com/Conversation"
    pattern: "projects/{project}/locations/{location}/conversations/{conversation}"
    plural: "conversations"
    singular: "conversation"
  };

  // Optional. Identifier. The unique resource name of a conversation. Format:
  // `projects/{project}/locations/{location}/conversations/{conversation_id}`
  // `{conversation_id}` is the resource id and should be 63 characters or less
  // and must match the format described in
  // https://google.aip.dev/122#resource-id-segments
  //
  // Example:
  // `projects/1234567890/locations/us-central1/conversations/my-conversation`.
  //
  // It is recommended to skip setting this field during conversation creation
  // as it will be inferred automatically and overwritten with the
  // {parent}/conversations/{conversation_id}.
  string name = 1 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IDENTIFIER
  ];

  // Required. Agent(s) in the conversation.
  // Currently, only one agent is supported. This field is repeated to allow
  // for future support of multiple agents in a conversation.
  // Format: `projects/{project}/locations/{location}/dataAgents/{agent}`
  repeated string agents = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. Creation timestamp.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp of the last used conversation.
  google.protobuf.Timestamp last_used_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Open-ended and user-defined labels that can be set by the client
  // to tag a conversation (e.g. to filter conversations for specific
  // surfaces/products).
  map<string, string> labels = 9 [(google.api.field_behavior) = OPTIONAL];
}

// Request for creating a conversation.
message CreateConversationRequest {
  // Required. Parent value for CreateConversationRequest.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "geminidataanalytics.googleapis.com/Conversation"
    }
  ];

  // Optional. The conversation id of the conversation to create.
  // Must be unique within the parent.
  // The allowed format is: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
  // If not provided, the server will auto-generate a value for the id.
  string conversation_id = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. The conversation to create.
  Conversation conversation = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  string request_id = 4 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Request for getting a conversation based on parent and conversation id.
message GetConversationRequest {
  // Required. Name of the resource.
  // Format:
  // `projects/{project}/locations/{location}/conversations/{conversation}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "geminidataanalytics.googleapis.com/Conversation"
    }
  ];
}

// Request for listing conversations based on parent.
message ListConversationsRequest {
  // Required. Parent value for ListConversationsRequest.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "geminidataanalytics.googleapis.com/Conversation"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. The max page size is 100. All larger page sizes will be coerced
  // to 100. If unspecified, server will pick 50 as an approperiate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Returned conversations will match criteria specified within the
  // filter. ListConversations allows filtering by:
  //  * agent_id
  //  * labels
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Message for response to listing conversations.
message ListConversationsResponse {
  // The list of conversations.
  repeated Conversation conversations = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}
