// Copyright 2024 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.actions.sdk.v2.conversation;

import "google/actions/sdk/v2/conversation/prompt/content/image.proto";
import "google/actions/sdk/v2/conversation/prompt/content/link.proto";

option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2/conversation;conversation";
option java_multiple_files = true;
option java_outer_classname = "TableProto";
option java_package = "com.google.actions.sdk.v2.conversation";

// A table card for displaying a table of text.
message Table {
  // Overall title of the table. Optional but must be set if subtitle is set.
  string title = 1;

  // Subtitle for the table. Optional.
  string subtitle = 2;

  // Image associated with the table. Optional.
  Image image = 4;

  // Headers and alignment of columns.
  repeated TableColumn columns = 5;

  // Row data of the table. The first 3 rows are guaranteed to be shown but
  // others might be cut on certain surfaces. Please test with the simulator to
  // see which rows will be shown for a given surface. On surfaces that support
  // the WEB_BROWSER capability, you can point the user to
  // a web page with more data.
  repeated TableRow rows = 6;

  // Button.
  Link button = 7;
}

// Describes a column in a table.
message TableColumn {
  // The alignment of the content within the cell.
  enum HorizontalAlignment {
    // Unspecified horizontal alignment.
    UNSPECIFIED = 0;

    // Leading edge of the cell. This is the default.
    LEADING = 1;

    // Content is aligned to the center of the column.
    CENTER = 2;

    // Content is aligned to the trailing edge of the column.
    TRAILING = 3;
  }

  // Header text for the column.
  string header = 1;

  // Horizontal alignment of content w.r.t column. If unspecified, content
  // will be aligned to the leading edge.
  HorizontalAlignment align = 2;
}

// Describes a cell in a row.
message TableCell {
  // Text content of the cell.
  string text = 1;
}

// Describes a row in the table.
message TableRow {
  // Cells in this row. The first 3 cells are guaranteed to be shown but
  // others might be cut on certain surfaces. Please test with the simulator
  // to see which cells will be shown for a given surface.
  repeated TableCell cells = 1;

  // Indicates whether there should be a divider after each row.
  bool divider = 2;
}
