// 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.shopping.merchant.issueresolution.v1beta;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option csharp_namespace = "Google.Shopping.Merchant.IssueResolution.V1Beta";
option go_package = "cloud.google.com/go/shopping/merchant/issueresolution/apiv1beta/issueresolutionpb;issueresolutionpb";
option java_multiple_files = true;
option java_outer_classname = "IssueResolutionProto";
option java_package = "com.google.shopping.merchant.issueresolution.v1beta";
option php_namespace = "Google\\Shopping\\Merchant\\IssueResolution\\V1beta";
option ruby_package = "Google::Shopping::Merchant::IssueResolution::V1beta";
option (google.api.resource_definition) = {
  type: "merchantapi.googleapis.com/Account"
  pattern: "accounts/{account}"
};
option (google.api.resource_definition) = {
  type: "merchantapi.googleapis.com/Product"
  pattern: "accounts/{account}/products/{product}"
};

// Service to provide an issue resolution content for account issues and product
// issues.
service IssueResolutionService {
  option (google.api.default_host) = "merchantapi.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";

  // Provide a list of business's account issues with an issue resolution
  // content and available actions. This content and actions are meant to be
  // rendered and shown in third-party applications.
  rpc RenderAccountIssues(RenderAccountIssuesRequest)
      returns (RenderAccountIssuesResponse) {
    option (google.api.http) = {
      post: "/issueresolution/v1beta/{name=accounts/*}:renderaccountissues"
      body: "payload"
    };
    option (google.api.method_signature) = "name";
  }

  // Provide a list of issues for business's product with an issue resolution
  // content and available actions. This content and actions are meant to be
  // rendered and shown in third-party applications.
  rpc RenderProductIssues(RenderProductIssuesRequest)
      returns (RenderProductIssuesResponse) {
    option (google.api.http) = {
      post: "/issueresolution/v1beta/{name=accounts/*/products/*}:renderproductissues"
      body: "payload"
    };
    option (google.api.method_signature) = "name";
  }

  // Start an action. The action can be requested by a business in
  // third-party application. Before the business can request the action, the
  // third-party application needs to show them action specific content and
  // display a user input form.
  //
  // The action can be successfully started only once all `required` inputs are
  // provided. If any `required` input is missing, or invalid value was
  // provided, the service will return 400 error. Validation errors will contain
  // [Ids][google.shopping.merchant.issueresolution.v1beta.InputField.id] for
  // all problematic field together with translated, human readable error
  // messages that can be shown to the user.
  rpc TriggerAction(TriggerActionRequest) returns (TriggerActionResponse) {
    option (google.api.http) = {
      post: "/issueresolution/v1beta/{name=accounts/*}:triggeraction"
      body: "payload"
    };
    option (google.api.method_signature) = "name";
  }
}

// Enum specifying the severity of the issue.
enum Severity {
  // Default value. Will never be provided by the API.
  SEVERITY_UNSPECIFIED = 0;

  // Causes either an account suspension or an item disapproval. Errors should
  // be resolved as soon as possible to ensure items are eligible to appear in
  // results again.
  ERROR = 1;

  // Warnings can negatively impact the performance of ads and can lead to item
  // or account suspensions in the future unless the issue is resolved.
  WARNING = 2;

  // Infos are suggested optimizations to increase data quality. Resolving these
  // issues is recommended, but not required.
  INFO = 3;
}

// Enum specifying how is the content returned.
enum ContentOption {
  // Default value. Will never be provided by the API.
  CONTENT_OPTION_UNSPECIFIED = 0;

  // Returns the detail of the issue as a pre-rendered HTML text.
  PRE_RENDERED_HTML = 1;
}

// Enum specifying how actions with user input forms, such as requesting
// re-review, are handled.
enum UserInputActionRenderingOption {
  // Default value. Will never be provided by the API.
  USER_INPUT_ACTION_RENDERING_OPTION_UNSPECIFIED = 0;

  // Actions that require user input are represented only as links that points
  // the business to Merchant Center where they can request the action. Provides
  // easier to implement alternative to `BUILT_IN_USER_INPUT_ACTIONS`.
  REDIRECT_TO_MERCHANT_CENTER = 1;

  // Returns content and input form definition for each complex action. Your
  // application needs to display this content and input form to the business
  // before they can request processing of the action. To start the action, your
  // application needs to call the `triggeraction` method.
  BUILT_IN_USER_INPUT_ACTIONS = 2;
}

// Response containing an issue resolution content and actions for listed
// account issues.
message RenderAccountIssuesResponse {
  // List of account issues for a given account.
  //
  // This list can be shown with compressed, expandable items. In the compressed
  // form, the title and impact should be shown for each issue. Once the issue
  // is expanded, the detailed
  // [content][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.prerendered_content]
  // and available
  // [actions][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.actions]
  // should be rendered.
  repeated RenderedIssue rendered_issues = 1;
}

// Request to provide issue resolution content and actions for business's
// account issues.
message RenderAccountIssuesRequest {
  // Required. The account to fetch issues for.
  // Format: `accounts/{account}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/Account"
    }
  ];

  // Optional. The [IETF BCP-47](https://tools.ietf.org/html/bcp47) language
  // code used to localize issue resolution content. If not set, the result will
  // be in default language `en-US`.
  string language_code = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The [IANA](https://www.iana.org/time-zones) timezone used to
  // localize times in an issue resolution content. For example
  // 'America/Los_Angeles'. If not set, results will use as a default UTC.
  string time_zone = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The payload for configuring how the content should be rendered.
  RenderIssuesRequestPayload payload = 4
      [(google.api.field_behavior) = OPTIONAL];
}

// The payload for configuring how the content should be rendered.
message RenderIssuesRequestPayload {
  // Optional. How the detailed content should be returned. Default option is to
  // return the content as a pre-rendered HTML text.
  optional ContentOption content_option = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. How actions with user input form should be handled. If not
  // provided, actions will be returned as links that points the business to
  // Merchant Center where they can request the action.
  optional UserInputActionRenderingOption user_input_action_option = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Response containing an issue resolution content and actions for listed
// product issues.
message RenderProductIssuesResponse {
  // List of issues for a given product.
  //
  // This list can be shown with compressed, expandable items. In the compressed
  // form, the
  // [title][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.title]
  // and
  // [impact][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.impact]
  // should be shown for each issue. Once the issue is expanded, the detailed
  // [content][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.prerendered_content]
  // and available
  // [actions][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.actions]
  // should be rendered.
  repeated RenderedIssue rendered_issues = 1;
}

// Request to provide an issue resolution content and actions for product issues
// of business's product.
message RenderProductIssuesRequest {
  // Required. The name of the product to fetch issues for.
  // Format: `accounts/{account}/products/{product}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/Product"
    }
  ];

  // Optional. The [IETF BCP-47](https://tools.ietf.org/html/bcp47) language
  // code used to localize an issue resolution content. If not set, the result
  // will be in default language `en-US`.
  string language_code = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The [IANA](https://www.iana.org/time-zones) timezone used to
  // localize times in an issue resolution content. For example
  // 'America/Los_Angeles'. If not set, results will use as a default UTC.
  string time_zone = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The payload for configuring how the content should be rendered.
  RenderIssuesRequestPayload payload = 4
      [(google.api.field_behavior) = OPTIONAL];
}

// An issue affecting specific business or their product.
message RenderedIssue {
  // Detailed content of the issue. Should be shown to the business when they
  // expand the issue. The form in which is the content returned is specified
  // with the [content
  // option][google.shopping.merchant.issueresolution.v1beta.RenderIssuesRequestPayload.content_option]
  // request field.
  oneof content {
    // Details of the issue as a pre-rendered HTML. HTML elements contain CSS
    // classes that can be used to customize the style of the content.
    //
    // Always sanitize the HTML before embedding it directly to your
    // application. The sanitizer needs to allow basic HTML tags, such as:
    // `div`, `span`, `p`, `a`, `ul`, `li`, `table`, `tr`, `td`. For example,
    // you can use [DOMPurify](https://www.npmjs.com/package/dompurify).
    //
    // CSS classes:
    //
    // * `issue-detail` - top level container for the detail of the issue
    // * `callout-banners` - section of the `issue-detail` with callout banners
    // * `callout-banner` - single callout banner, inside `callout-banners`
    // * `callout-banner-info` - callout with important information (default)
    // * `callout-banner-warning` - callout with a warning
    // * `callout-banner-error` - callout informing about an error (most severe)
    // * `issue-content` - section of the `issue-detail`, contains multiple
    // `content-element`
    // * `content-element` - content element such as a list, link or paragraph,
    // inside `issue-content`
    // * `root-causes` - unordered list with items describing root causes of the
    // issue, inside `issue-content`
    // * `root-causes-intro` - intro text before the `root-causes` list, inside
    // `issue-content`
    // * `segment` - section of the text, `span` inside paragraph
    // * `segment-attribute` - section of the text that represents a product
    // attribute, for example 'image\_link'
    // * `segment-literal` - section of the text that contains a special value,
    // for example '0-1000 kg'
    // * `segment-bold` - section of the text that should be rendered as bold
    // * `segment-italic` - section of the text that should be rendered as
    // italic
    // * `tooltip` - used on paragraphs that should be rendered with a tooltip.
    // A section of the text in such a paragraph will have a class
    // `tooltip-text` and is intended to be shown in a mouse over dialog. If the
    // style is not used, the `tooltip-text` section would be shown on a new
    // line, after the main part of the text.
    // * `tooltip-text` - marks a section of the text within a `tooltip`, that
    // is intended to be shown in a mouse over dialog.
    // * `tooltip-icon` - marks a section of the text within a `tooltip`, that
    // can be replaced with a tooltip icon, for example '?' or 'i'. By default,
    // this section contains a `br` tag, that is separating the main text and
    // the tooltip text when the style is not used.
    // * `tooltip-style-question` - the tooltip shows helpful information,
    // can use the '?' as an icon.
    // * `tooltip-style-info` - the tooltip adds additional information fitting
    // to the context, can use the 'i' as an icon.
    // * `content-moderation` - marks the paragraph that explains how the issue
    // was identified.
    // * `new-element` - Present for new elements added to the pre-rendered
    // content in the future. To make sure that a new content element does not
    // break your style, you can hide everything with this class.
    string prerendered_content = 3;
  }

  // Out-of-court dispute settlement (ODS) contains a link to a page where
  // the business can bring their appeal to an [external
  // body](https://support.google.com/european-union-digital-services-act-redress-options/answer/13535501).
  // It may contains a detailed instructions and any values needed for the
  // business to proceed with their request.
  //
  // The ODS is a part of the EU's Digital Service ACT (DSA). If present, it
  // should be shown to the business.
  //
  // The ODS may differ for individual issues and thus it should be by default
  // shown in the detail of the issue. It could be shown next to
  // [actions][google.shopping.merchant.issueresolution.v1beta.RenderedIssue.actions]
  // for the issue.
  //
  // In some cases the ODS could be the same for all issues in the list. If the
  // values for individual issues do not differ, then the ODS could be shown
  // only once. For example under the list with issues. This is an optional UX
  // improvement. If values differ, then ODS needs to be shown in details of
  // individual issues.
  oneof out_of_court_dispute_settlement {
    // Pre-rendered HTML that contains a link to the external location where the
    // ODS can be requested and instructions for how to request it. HTML
    // elements contain CSS classes that can be used to customize the style of
    // this snippet.
    //
    // Always sanitize the HTML before embedding it directly to your
    // application. The sanitizer needs to allow basic HTML tags, such as:
    // `div`, `span`, `p`, `a`, `ul`, `li`, `table`, `tr`, `td`. For example,
    // you can use [DOMPurify](https://www.npmjs.com/package/dompurify).
    //
    // CSS classes:
    //
    // * `ods-section`* - wrapper around the out-of-court dispute resolution
    // section
    // * `ods-description`* - intro text for the out-of-court dispute
    // resolution. It may contain multiple segments and a link.
    // * `ods-param`* - wrapper around the header-value pair for parameters that
    // the business may need to provide during the ODS process.
    // * `ods-routing-id`* - ods param for the Routing ID.
    // * `ods-reference-id`* - ods param for the Routing ID.
    // * `ods-param-header`* - header for the ODS parameter
    // * `ods-param-value`* - value of the ODS parameter. This value should be
    // rendered in a way that it is easy for the user to identify and copy.
    // * `segment` - section of the text, `span` inside paragraph
    // * `segment-attribute` - section of the text that represents a product
    // attribute, for example 'image\_link'
    // * `segment-literal` - section of the text that contains a special value,
    // for example '0-1000 kg'
    // * `segment-bold` - section of the text that should be rendered as bold
    // * `segment-italic` - section of the text that should be rendered as
    // italic
    // * `tooltip` - used on paragraphs that should be rendered with a tooltip.
    // A section of the text in such a paragraph will have a class
    // `tooltip-text` and is intended to be shown in a mouse over dialog. If the
    // style is not used, the `tooltip-text` section would be shown on a new
    // line, after the main part of the text.
    // * `tooltip-text` - marks a section of the text within a `tooltip`, that
    // is intended to be shown in a mouse over dialog.
    // * `tooltip-icon` - marks a section of the text within a `tooltip`, that
    // can be replaced with a tooltip icon, for example '?' or 'i'. By default,
    // this section contains a `br` tag, that is separating the main text and
    // the tooltip text when the style is not used.
    // * `tooltip-style-question` - the tooltip shows helpful information,
    // can use the '?' as an icon.
    // * `tooltip-style-info` - the tooltip adds additional information fitting
    // to the context, can use the 'i' as an icon.
    string prerendered_out_of_court_dispute_settlement = 5;
  }

  // Title of the issue.
  string title = 1;

  // Clarifies the severity of the issue.
  //
  // The [summarizing
  // message][google.shopping.merchant.issueresolution.v1beta.Impact.message],
  // if present, should be shown right under the title for each issue. It helps
  // business to quickly understand the impact of the issue.
  //
  // The detailed
  // [breakdown][google.shopping.merchant.issueresolution.v1beta.Impact.breakdowns]
  // helps the business to fully understand the impact of the issue. It can be
  // rendered as dialog that opens when the business mouse over the summarized
  // impact statement.
  //
  // Issues with different
  // [severity][google.shopping.merchant.issueresolution.v1beta.Impact.severity]
  // can be styled differently. They may use a different color or icon to signal
  // the difference between `ERROR`, `WARNING` and `INFO`.
  Impact impact = 2;

  // A list of actionable steps that can be executed to solve the issue. An
  // example is requesting a re-review or providing arguments when business
  // disagrees with the issue.
  //
  // Actions that are supported in (your) third-party application can be
  // rendered as buttons and should be available to the business when they
  // expand the issue.
  repeated Action actions = 4;
}

// Overall impact of the issue.
message Impact {
  // Optional. Message summarizing the overall impact of the issue. If present,
  // it should be rendered to the business. For example: "Disapproves 90k offers
  // in 25 countries"
  string message = 1 [(google.api.field_behavior) = OPTIONAL];

  // The severity of the issue.
  Severity severity = 2;

  // Detailed impact breakdown. Explains the types of restriction the issue has
  // in different shopping destinations and territory. If present, it should be
  // rendered to the business. Can be shown as a mouse over dropdown or a
  // dialog. Each breakdown item represents a group of regions with the same
  // impact details.
  repeated Breakdown breakdowns = 3;
}

// A detailed impact breakdown for a group of regions where the impact of the
// issue on different shopping destinations is the same.
message Breakdown {
  // Region with code and localized name.
  message Region {
    // The [CLDR territory code]
    // (http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml)
    string code = 1;

    // The localized name of the region.
    // For region with code='001' the value is 'All countries' or the equivalent
    // in other languages.
    string name = 2;
  }

  // Lists of regions. Should be rendered as a title for this group of details.
  // The full list should be shown to the business. If the list is too long, it
  // is recommended to make it expandable.
  repeated Region regions = 1;

  // Human readable, localized description of issue's effect on different
  // targets. Should be rendered as a list.
  //
  // For example:
  //
  // * "Products not showing in ads"
  // * "Products not showing organically"
  repeated string details = 4;
}

// An actionable step that can be executed to solve the issue.
message Action {
  // A single reason why the action is not available.
  message Reason {
    // Messages summarizing the reason, why the action is not available.
    // For example: "Review requested on Jan 03. Review requests can take a few
    // days to complete."
    string message = 1;

    // Detailed explanation of the reason. Should be displayed as a hint if
    // present.
    optional string detail = 2;

    // Optional. An action that needs to be performed to solve the problem
    // represented by this reason. This action will always be available. Should
    // be rendered as a link or button next to the summarizing message.
    //
    // For example, the review may be available only once the business configure
    // all required attributes. In such a situation this action can be a link to
    // the form, where they can fill the missing attribute to unblock the main
    // action.
    optional Action action = 3 [(google.api.field_behavior) = OPTIONAL];
  }

  // An actionable step that can be executed to solve the issue.
  oneof action {
    // Action implemented and performed in (your) third-party application. The
    // application should point the business to the place, where they can access
    // the corresponding functionality or provide instructions, if the specific
    // functionality is not available.
    BuiltInSimpleAction builtin_simple_action = 2;

    // Action that is implemented and performed outside of (your) third-party
    // application. The application needs to redirect the business to the
    // external location where they can perform the action.
    ExternalAction external_action = 3;

    // Action implemented and performed in (your) third-party application.
    // The application needs to show an additional content and input form to the
    // business as specified for given action. They can trigger the action only
    // when they provided all required inputs.
    BuiltInUserInputAction builtin_user_input_action = 7;
  }

  // Label of the action button.
  string button_label = 4;

  // Controlling whether the button is active or disabled. The value is 'false'
  // when the action was already requested or is not available. If the action is
  // not available then a
  // [reason][google.shopping.merchant.issueresolution.v1beta.Action.reasons]
  // will be present. If (your) third-party application shows a disabled button
  // for action that is not available, then it should also show reasons.
  bool is_available = 5;

  // List of reasons why the action is not available. The list of reasons is
  // empty if the action is available. If there is only one reason, it can be
  // displayed next to the disabled button. If there are more reasons, all of
  // them should be displayed, for example in a pop-up dialog.
  repeated Reason reasons = 6;
}

// Action that is implemented and performed in (your) third-party application.
// Represents various functionality that is expected to be available to business
// and will help them with resolving the issue. The application should point the
// business to the place, where they can access the corresponding functionality.
// If the functionality is not supported, it is recommended to explain the
// situation to the business and provide them with instructions how to solve the
// issue.
message BuiltInSimpleAction {
  // Long text from external source.
  message AdditionalContent {
    // Title of the additional content;
    string title = 1;

    // Long text organized into paragraphs.
    repeated string paragraphs = 2;
  }

  // Enum specifying the type of action in third-party application.
  enum BuiltInSimpleActionType {
    // Default value. Will never be provided by the API.
    BUILT_IN_SIMPLE_ACTION_TYPE_UNSPECIFIED = 0;

    // Redirect the business to the part of your application where they can
    // verify their phone.
    VERIFY_PHONE = 1;

    // Redirect the business to the part of your application where they can
    // claim their website.
    CLAIM_WEBSITE = 2;

    // Redirect the business to the part of your application where they can add
    // products.
    ADD_PRODUCTS = 3;

    // Open a form where the business can edit their contact information.
    ADD_CONTACT_INFO = 4;

    // Redirect the business to the part of your application where they can link
    // ads account.
    LINK_ADS_ACCOUNT = 5;

    // Open a form where the business can add their business registration
    // number.
    ADD_BUSINESS_REGISTRATION_NUMBER = 6;

    // Open a form where the business can edit an attribute. The attribute that
    // needs to be updated is specified in
    // [attribute_code][google.shopping.merchant.issueresolution.v1beta.BuiltInSimpleAction.attribute_code]
    // field of the action.
    EDIT_ITEM_ATTRIBUTE = 7;

    // Redirect the business from the product issues to the diagnostic page with
    // their account issues in your application.
    //
    // This action will be returned only for product issues that are caused by
    // an account issue and thus the business should resolve the problem on the
    // account level.
    FIX_ACCOUNT_ISSUE = 8;

    // Show [additional
    // content][google.shopping.merchant.issueresolution.v1beta.BuiltInSimpleAction.additional_content]
    // to the business.
    //
    // This action will be used for example to deliver a justification from
    // national authority.
    SHOW_ADDITIONAL_CONTENT = 9;
  }

  // The type of action that represents a functionality that is expected to be
  // available in third-party application.
  BuiltInSimpleActionType type = 1;

  // The attribute that needs to be updated. Present when the
  // [type][google.shopping.merchant.issueresolution.v1beta.BuiltInSimpleAction.type]
  // is `EDIT_ITEM_ATTRIBUTE`.
  //
  // This field contains a code for attribute, represented in snake_case. You
  // can find a list of product's attributes, with their codes
  // [here](https://support.google.com/merchants/answer/7052112).
  optional string attribute_code = 2;

  // Long text from an external source that should be available to the business.
  // Present when the
  // [type][google.shopping.merchant.issueresolution.v1beta.BuiltInSimpleAction.type]
  // is `SHOW_ADDITIONAL_CONTENT`.
  optional AdditionalContent additional_content = 3;
}

// Action that is implemented and performed in (your) third-party application.
// The application needs to show an additional content and input form to the
// business. They can start the action only when they provided all required
// inputs. The application will request processing of the action by calling the
// [triggeraction
// method](https://developers.google.com/merchant/api/reference/rest/issueresolution_v1beta/issueresolution/triggeraction).
message BuiltInUserInputAction {
  // Contains the action's context that must be included as part of the
  // [TriggerActionPayload.action_context][google.shopping.merchant.issueresolution.v1beta.TriggerActionPayload.action_context]
  // in
  // [TriggerActionRequest.payload][google.shopping.merchant.issueresolution.v1beta.TriggerActionRequest.payload]
  // to call the `triggeraction` method. The content should be treated as opaque
  // and must not be modified.
  string action_context = 1;

  // Actions may provide multiple different flows. Business selects one that
  // fits best to their intent. Selecting the flow is the first step in user's
  // interaction with the action. It affects what input fields will be available
  // and required and also how the request will be processed.
  repeated ActionFlow flows = 3;
}

// Flow that can be selected for an action. When a business selects a flow,
// application should open a dialog with more information and input form.
message ActionFlow {
  // Not for display but need to be sent back for the selected action flow.
  string id = 1;

  // Text value describing the intent for the action flow. It can be used as an
  // input label if business needs to pick one of multiple flows. For example:
  // "I disagree with the issue"
  string label = 2;

  // A list of input fields.
  repeated InputField inputs = 3;

  // Title of the request dialog. For example: "Before you request a review"
  string dialog_title = 4;

  // Message displayed in the request dialog. For example: "Make sure you've
  // fixed all your country-specific issues. If not, you may have to wait 7 days
  // to request another review". There may be an more information to be shown in
  // a tooltip.
  optional TextWithTooltip dialog_message = 7;

  // Important message to be highlighted in the request dialog. For example:
  // "You can only request a review for disagreeing with this issue once. If
  // it's not approved, you'll need to fix the issue and wait a few days before
  // you can request another review."
  optional Callout dialog_callout = 8;

  // Label for the button to trigger the action from the action dialog. For
  // example: "Request review"
  string dialog_button_label = 9;
}

// Input field that needs to be available to the business. If the field is
// marked as required, then a value needs to be provided for a successful
// processing of the request.
message InputField {
  // Text input allows the business to provide a text value.
  message TextInput {
    // Enum specifying the type of the text input and how it should be rendered.
    enum TextInputType {
      // Default value. Will never be provided by the API.
      TEXT_INPUT_TYPE_UNSPECIFIED = 0;

      // Used when a short text is expected. The field can be rendered as a
      // [text
      // field](https://www.w3.org/TR/2012/WD-html-markup-20121025/input.text.html#input.text).
      GENERIC_SHORT_TEXT = 1;

      // Used when a longer text is expected. The field should be rendered as a
      // [textarea](https://www.w3.org/TR/2012/WD-html-markup-20121025/textarea.html#textarea).
      GENERIC_LONG_TEXT = 2;
    }

    // Type of the text input
    TextInputType type = 1;

    // Additional info regarding the field to be displayed to the business. For
    // example, warning to not include personal identifiable information. There
    // may be more information to be shown in a tooltip.
    optional TextWithTooltip additional_info = 2;

    // Information about the required format. If present, it should be shown
    // close to the input field to help the business to provide a correct value.
    // For example: "VAT numbers should be in a format similar to SK9999999999"
    optional string format_info = 3;

    // Text to be used as the
    // [aria-label](https://www.w3.org/TR/WCAG20-TECHS/ARIA14.html) for the
    // input.
    optional string aria_label = 4;
  }

  // Choice input allows the business to select one of the offered choices. Some
  // choices may be linked to additional input fields that should be displayed
  // under or next to the choice option. The value for the additional input
  // field needs to be provided only when the specific choice is selected by the
  // the business. For example, additional input field can be hidden or disabled
  // until the business selects the specific choice.
  message ChoiceInput {
    // A choice that the business can select.
    message ChoiceInputOption {
      // Not for display but need to be sent back for the selected choice
      // option.
      string id = 1;

      // Short description of the choice option. There may be more information
      // to be shown as a tooltip.
      TextWithTooltip label = 2;

      // Input that should be displayed when this option is selected.
      // The additional input will not contain a `ChoiceInput`.
      optional InputField additional_input = 3;
    }

    // A list of choices. Only one option can be selected.
    repeated ChoiceInputOption options = 1;
  }

  // Checkbox input allows the business to provide a boolean value. Corresponds
  // to the [html input
  // type=checkbox](https://www.w3.org/TR/2012/WD-html-markup-20121025/input.checkbox.html#input.checkbox).
  //
  // If the business checks the box, the input value for the field is `true`,
  // otherwise it is `false`.
  //
  // This type of input is often used as a confirmation that the business
  // completed required steps before they are allowed to start the action. In
  // such a case, the input field is marked as
  // [required][google.shopping.merchant.issueresolution.v1beta.InputField.required]
  // and the button to trigger the action should stay disabled until the
  // business checks the box.
  message CheckboxInput {}

  // Specific type of the input field.
  oneof value_input {
    // Input field to provide text information.
    // Corresponds to the [html input
    // type=text](https://www.w3.org/TR/2012/WD-html-markup-20121025/input.text.html#input.text)
    // or [html
    // textarea](https://www.w3.org/TR/2012/WD-html-markup-20121025/textarea.html#textarea).
    TextInput text_input = 4;

    // Input field to select one of the offered choices.
    // Corresponds to the [html input
    // type=radio](https://www.w3.org/TR/2012/WD-html-markup-20121025/input.radio.html#input.radio).
    ChoiceInput choice_input = 5;

    // Input field to provide a boolean value.
    // Corresponds to the [html input
    // type=checkbox](https://www.w3.org/TR/2012/WD-html-markup-20121025/input.checkbox.html#input.checkbox).
    CheckboxInput checkbox_input = 6;
  }

  // Not for display but need to be sent back for the given input field.
  string id = 1;

  // Input field label. There may be more information to be shown in a tooltip.
  TextWithTooltip label = 2;

  // Whether the field is required. The action button needs to stay disabled
  // till values for all required fields are provided.
  bool required = 3;
}

// Block of text that may contain a tooltip with more information.
message TextWithTooltip {
  // Enum specifying the type of an icon that is being used to display a
  // corresponding tooltip in the Merchant Center.
  enum TooltipIconStyle {
    // Default value. Will never be provided by the API.
    TOOLTIP_ICON_STYLE_UNSPECIFIED = 0;

    // Used when the tooltip adds additional information to the context,
    // the 'i' can be used as an icon.
    INFO = 1;

    // Used when the tooltip shows helpful information, the '?' can be used as
    // an icon.
    QUESTION = 2;
  }

  // Value of the text message. The form in which the value is returned is
  // specified with the content option request field.
  oneof value {
    // Value of the message as a simple text.
    string simple_value = 1;
  }

  // Text that is meant to be shown in a tooltip for the main message. The
  // tooltip is present when there is additional content needed to be available
  // to the business. The form in which the value is returned is specified with
  // the content option request field.
  oneof tooltip_value {
    // Value of the tooltip as a simple text.
    string simple_tooltip_value = 2;
  }

  // The suggested type of an icon for tooltip, if a tooltip is present.
  TooltipIconStyle tooltip_icon_style = 3;
}

// An important message that should be highlighted. Usually displayed as a
// banner.
message Callout {
  // Enum specifying the suggested style, how the message should be rendered.
  enum CalloutStyleHint {
    // Default value. Will never be provided by the API.
    CALLOUT_STYLE_HINT_UNSPECIFIED = 0;

    // The most important type of information highlighting problems, like an
    // unsuccessful outcome of previously requested actions.
    ERROR = 1;

    // Information warning about pending problems, risks or deadlines.
    WARNING = 2;

    // Default severity for important information like pending status of
    // previously requested action or cooldown for re-review.
    INFO = 3;
  }

  // Can be used to render messages with different severity in different styles.
  // Snippets off all types contain important information that should be
  // displayed to the business.
  CalloutStyleHint style_hint = 1;

  // A full message that needs to be shown to the business.
  TextWithTooltip full_message = 3;
}

// Action that is implemented and performed outside of the third-party
// application. It should redirect the business to the provided URL of an
// external system where they can perform the action. For example to request a
// review in the Merchant Center.
message ExternalAction {
  // Enum specifying the type of action that requires to redirect the business
  // to an external location.
  enum ExternalActionType {
    // Default value. Will never be provided by the API.
    EXTERNAL_ACTION_TYPE_UNSPECIFIED = 0;

    // Redirect to Merchant Center where the business can request a review for
    // issue related to their product.
    REVIEW_PRODUCT_ISSUE_IN_MERCHANT_CENTER = 1;

    // Redirect to Merchant Center where the business can request a review for
    // issue related to their account.
    REVIEW_ACCOUNT_ISSUE_IN_MERCHANT_CENTER = 2;

    // Redirect to the form in Help Center where the business can request a
    // legal appeal for the issue.
    LEGAL_APPEAL_IN_HELP_CENTER = 3;

    // Redirect to Merchant Center where the business can perform identity
    // verification.
    VERIFY_IDENTITY_IN_MERCHANT_CENTER = 4;
  }

  // The type of external action.
  ExternalActionType type = 1;

  // URL to external system, for example Merchant Center, where the business can
  // perform the action.
  string uri = 2;
}

// Request to start the selected action
message TriggerActionRequest {
  // Required. The business's account that is triggering the action.
  // Format: `accounts/{account}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/Account"
    }
  ];

  // Required. The payload for the triggered action.
  TriggerActionPayload payload = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Language code [IETF BCP 47
  // syntax](https://tools.ietf.org/html/bcp47) used to localize the response.
  // If not set, the result will be in default language `en-US`.
  string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
}

// The payload for the triggered action.
message TriggerActionPayload {
  // Required. The
  // [context][google.shopping.merchant.issueresolution.v1beta.BuiltInUserInputAction.action_context]
  // from the selected action. The value is obtained from rendered issues and
  // needs to be sent back to identify the
  // [action][google.shopping.merchant.issueresolution.v1beta.Action.builtin_user_input_action]
  // that is being triggered.
  string action_context = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Input provided by the business.
  ActionInput action_input = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response informing about the started action.
message TriggerActionResponse {
  // The message for the business.
  string message = 1;
}

// Input provided by the business.
message ActionInput {
  // Required.
  // [Id][google.shopping.merchant.issueresolution.v1beta.ActionFlow.id] of the
  // selected action flow.
  string action_flow_id = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Values for input fields.
  repeated InputValue input_values = 2 [(google.api.field_behavior) = REQUIRED];
}

// Input provided by the business for input field.
message InputValue {
  // Value for [text
  // input][google.shopping.merchant.issueresolution.v1beta.InputField.TextInput]
  // field.
  message TextInputValue {
    // Required. Text provided by the business.
    string value = 1 [(google.api.field_behavior) = REQUIRED];
  }

  // Value for [choice
  // input][google.shopping.merchant.issueresolution.v1beta.InputField.ChoiceInput]
  // field.
  message ChoiceInputValue {
    // Required. [Id][InputField.ChoiceInput.id] of the option that was selected
    // by the business.
    string choice_input_option_id = 1 [(google.api.field_behavior) = REQUIRED];
  }

  // Value for [checkbox
  // input][google.shopping.merchant.issueresolution.v1beta.InputField.CheckboxInput]
  // field.
  message CheckboxInputValue {
    // Required. True if the business checked the box field. False otherwise.
    bool value = 1 [(google.api.field_behavior) = REQUIRED];
  }

  // Value provided by the business.
  oneof value {
    // Value for [text
    // input][google.shopping.merchant.issueresolution.v1beta.InputField.TextInput]
    // field.
    TextInputValue text_input_value = 2;

    // Value for [choice
    // input][google.shopping.merchant.issueresolution.v1beta.InputField.ChoiceInput]
    // field.
    ChoiceInputValue choice_input_value = 3;

    // Value for [checkbox
    // input][google.shopping.merchant.issueresolution.v1beta.InputField.CheckboxInput]
    // field.
    CheckboxInputValue checkbox_input_value = 4;
  }

  // Required.
  // [Id][google.shopping.merchant.issueresolution.v1beta.InputField.id] of the
  // corresponding input field.
  string input_field_id = 1 [(google.api.field_behavior) = REQUIRED];
}
