// Copyright 2026 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.accounts.v1;

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

option csharp_namespace = "Google.Shopping.Merchant.Accounts.V1";
option go_package = "cloud.google.com/go/shopping/merchant/accounts/apiv1/accountspb;accountspb";
option java_multiple_files = true;
option java_outer_classname = "OmnichannelSettingsProto";
option java_package = "com.google.shopping.merchant.accounts.v1";
option php_namespace = "Google\\Shopping\\Merchant\\Accounts\\V1";
option ruby_package = "Google::Shopping::Merchant::Accounts::V1";

// The service facilitates the management of a merchant's omnichannel settings.
// ## This API defines the following resource model:
//
// [OmnichannelSetting][google.shopping.merchant.accounts.v1.OmnichannelSetting]
service OmnichannelSettingsService {
  option (google.api.default_host) = "merchantapi.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";

  // Get the omnichannel settings for a given merchant.
  rpc GetOmnichannelSetting(GetOmnichannelSettingRequest)
      returns (OmnichannelSetting) {
    option (google.api.http) = {
      get: "/accounts/v1/{name=accounts/*/omnichannelSettings/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // List all the omnichannel settings for a given merchant.
  rpc ListOmnichannelSettings(ListOmnichannelSettingsRequest)
      returns (ListOmnichannelSettingsResponse) {
    option (google.api.http) = {
      get: "/accounts/v1/{parent=accounts/*}/omnichannelSettings"
    };
    option (google.api.method_signature) = "parent";
  }

  // Create the omnichannel settings for a given merchant.
  rpc CreateOmnichannelSetting(CreateOmnichannelSettingRequest)
      returns (OmnichannelSetting) {
    option (google.api.http) = {
      post: "/accounts/v1/{parent=accounts/*}/omnichannelSettings"
      body: "omnichannel_setting"
    };
    option (google.api.method_signature) = "parent,omnichannel_setting";
  }

  // Update the omnichannel setting for a given merchant in a given country.
  rpc UpdateOmnichannelSetting(UpdateOmnichannelSettingRequest)
      returns (OmnichannelSetting) {
    option (google.api.http) = {
      patch: "/accounts/v1/{omnichannel_setting.name=accounts/*/omnichannelSettings/*}"
      body: "omnichannel_setting"
    };
    option (google.api.method_signature) = "omnichannel_setting,update_mask";
  }

  // Requests inventory verification for a given merchant in a given country.
  rpc RequestInventoryVerification(RequestInventoryVerificationRequest)
      returns (RequestInventoryVerificationResponse) {
    option (google.api.http) = {
      post: "/accounts/v1/{name=accounts/*/omnichannelSettings/*}:requestInventoryVerification"
      body: "*"
    };
    option (google.api.method_signature) = "name";
  }
}

// Collection of information related to the omnichannel settings of a merchant.
message OmnichannelSetting {
  option (google.api.resource) = {
    type: "merchantapi.googleapis.com/OmnichannelSetting"
    pattern: "accounts/{account}/omnichannelSettings/{omnichannel_setting}"
    plural: "omnichannelSettings"
    singular: "omnichannelSetting"
  };

  // The product page experience type, which is also called the Local Store
  // Front (LSF) type. Check the [HC
  // article](https://support.google.com/merchants/answer/7178526) for more
  // details.
  enum LsfType {
    // Default value. This value is unused.
    LSF_TYPE_UNSPECIFIED = 0;

    // Google-Hosted Local Store Front. Check the [HC
    // article](https://support.google.com/merchants/answer/14869424) for more
    // details.
    GHLSF = 1;

    // Merchant-Hosted Local Store Front Basic. Check the [HC
    // article](https://support.google.com/merchants/answer/14615867) for more
    // details.
    MHLSF_BASIC = 2;

    // Merchant-Hosted Local Store Front Full. Check the [HC
    // article](https://support.google.com/merchants/answer/14617076) for more
    // details.
    MHLSF_FULL = 3;
  }

  // Identifier. The resource name of the omnichannel setting. Format:
  // `accounts/{account}/omnichannelSettings/{omnichannel_setting}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. Immutable. Region code defined by
  // [CLDR](https://cldr.unicode.org/). Must be provided in the Create method,
  // and is immutable.
  string region_code = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. The Local Store Front type for this country.
  LsfType lsf_type = 12 [(google.api.field_behavior) = REQUIRED];

  // Optional. The InStock URI and state for this country.
  InStock in_stock = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Pickup URI and state for this country.
  Pickup pickup = 14 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The established link to a LFP provider.
  LfpLink lfp_link = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The On Display to Order (ODO) policy URI and state for this
  // country.
  OnDisplayToOrder odo = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The about page URI and state for this country.
  About about = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The inventory verification contact and state for this country.
  InventoryVerification inventory_verification = 8
      [(google.api.field_behavior) = OPTIONAL];
}

// The state of a omnichannel setting related review process.
message ReviewState {
  // The state of the review process.
  enum State {
    // Default value. This value is unused.
    STATE_UNSPECIFIED = 0;

    // The review process has concluded successfully. The reviewed item is
    // active.
    ACTIVE = 1;

    // The review process failed.
    FAILED = 2;

    // The review process is running.
    RUNNING = 3;

    // The review process is waiting for the merchant to take action.
    ACTION_REQUIRED = 4;
  }
}

// Collection of information related to InStock.
message InStock {
  // Optional. Product landing page URI. It is only used for the review of MHLSF
  // in-stock serving. This URI domain should match with the business's
  // homepage. Required to be empty if the lsf_type is GHLSF, and required when
  // the lsf_type is MHLSF_FULL or MHLSF_BASIC.
  string uri = 1 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The state of the in-stock serving.
  ReviewState.State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Collection of information related to Pickup.
message Pickup {
  // Required. Pickup product page URI. It is only used for the review of pickup
  // serving. This URI domain should match with the business's homepage.
  string uri = 1 [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the pickup serving.
  ReviewState.State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Collection of information related to the LFP link.
message LfpLink {
  // Required. The resource name of the LFP provider.
  // Format: `lfpProviders/{lfp_provider}`
  string lfp_provider = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The account ID by which this merchant is known to the LFP
  // provider.
  string external_account_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the LFP link.
  ReviewState.State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Collection of information related to the on display to order
// ([ODO](https://support.google.com/merchants/answer/14615056?ref_topic=15145747&sjid=6892280366904591178-NC)).
message OnDisplayToOrder {
  // Required. The on display to order (ODO) policy URI.
  string uri = 1 [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the URI.
  ReviewState.State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Collection of information related to the about page
// ([impressum](https://support.google.com/merchants/answer/14675634?ref_topic=15145634&sjid=6892280366904591178-NC)).
message About {
  // Required. The about page URI.
  string uri = 1 [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the URI.
  ReviewState.State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Collection of information related to [inventory
// verification](https://support.google.com/merchants/answer/14684499?ref_topic=15145634&sjid=6892280366904591178-NC).
message InventoryVerification {
  // The state of the [inventory
  // verification](https://support.google.com/merchants/answer/14684499?ref_topic=15145634&sjid=6892280366904591178-NC)
  // process.
  enum State {
    // Default value. This value is unused.
    STATE_UNSPECIFIED = 0;

    // When the merchant needs to initiate the inventory
    // verification process. The next state is INACTIVE.
    ACTION_REQUIRED = 1;

    // When the merchant is ready to request inventory verification.
    INACTIVE = 5;

    // The inventory verification process is running. If the merchant is
    // rejected, the next state is INACTIVE.
    RUNNING = 2;

    // The inventory verification process succeeded.
    SUCCEEDED = 3;

    // When merchant fails the inventory verification process and all attempts
    // are exhausted.
    SUSPENDED = 4;
  }

  // Output only. The state of the inventory verification process.
  State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. The name of the contact for the inventory verification process.
  string contact = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The email address of the contact for the inventory verification
  // process.
  string contact_email = 3 [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the contact verification.
  ReviewState.State contact_state = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for the GetOmnichannelSettings method.
message GetOmnichannelSettingRequest {
  // Required. The name of the omnichannel setting to retrieve.
  // Format: `accounts/{account}/omnichannelSettings/{omnichannel_setting}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/OmnichannelSetting"
    }
  ];
}

// Request message for the ListOmnichannelSettings method.
message ListOmnichannelSettingsRequest {
  // Required. The parent, which owns this collection of omnichannel settings.
  // Format: `accounts/{account}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/Account"
    }
  ];

  // Optional. The maximum number of omnichannel settings to return. The service
  // may return fewer than this value. If unspecified, at most 50 omnichannel
  // settings will be returned. The maximum value is 1000; values above 1000
  // will be coerced to 1000.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token, received from a previous `ListOmnichannelSettings`
  // call. Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListOmnichannelSettings`
  // must match the call that provided the page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for the ListOmnichannelSettings method.
message ListOmnichannelSettingsResponse {
  // The omnichannel settings from the specified merchant.
  repeated OmnichannelSetting omnichannel_settings = 1;

  // A token, which can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request message for the CreateOmnichannelSetting method.
message CreateOmnichannelSettingRequest {
  // Required. The parent resource where this omnichannel setting will be
  // created. Format: `accounts/{account}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/Account"
    }
  ];

  // Required. The omnichannel setting to create.
  OmnichannelSetting omnichannel_setting = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Request message for the UpdateOmnichannelSetting method.
message UpdateOmnichannelSettingRequest {
  // Required. The omnichannel setting to update.
  //
  // The omnichannel setting's `name` field is used to identify the
  // omnichannel setting to be updated.
  OmnichannelSetting omnichannel_setting = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The list of fields to be updated.
  //
  // The following fields are supported in snake_case only:
  // - `lsf_type`
  // - `in_stock`
  // - `pickup`
  // - `odo`
  // - `about`
  // - `inventory_verification`
  //
  // Full replacement with wildcard `*`is supported, while empty/implied update
  // mask is not.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Request message for the RequestInventoryVerification method.
message RequestInventoryVerificationRequest {
  // Required. The name of the omnichannel setting to request inventory
  // verification. Format:
  // `accounts/{account}/omnichannelSettings/{omnichannel_setting}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "merchantapi.googleapis.com/OmnichannelSetting"
    }
  ];
}

// Response message for the RequestInventoryVerification method.
message RequestInventoryVerificationResponse {
  // The omnichannel setting that was updated.
  OmnichannelSetting omnichannel_setting = 1;
}
