# Copyright 2019 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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLink do
  @moduledoc """
  Represents a link between a Merchant Center account and a branch. After a link is established, products from the linked Merchant Center account are streamed to the linked branch.

  ## Attributes

  *   `branchId` (*type:* `String.t`, *default:* `nil`) - Required. The branch ID (e.g. 0/1/2) within the catalog that products from merchant_center_account_id are streamed to. When updating this field, an empty value will use the currently configured default branch. However, changing the default branch later on won't change the linked branch here. A single branch ID can only have one linked Merchant Center account ID.
  *   `feedFilters` (*type:* `list(GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLinkMerchantCenterFeedFilter.t)`, *default:* `nil`) - Criteria for the Merchant Center feeds to be ingested via the link. All offers will be ingested if the list is empty. Otherwise the offers will be ingested from selected feeds.
  *   `feedLabel` (*type:* `String.t`, *default:* `nil`) - The FeedLabel used to perform filtering. Note: this replaces [region_id](https://developers.google.com/shopping-content/reference/rest/v2.1/products#Product.FIELDS.feed_label). Example value: `US`. Example value: `FeedLabel1`.
  *   `id` (*type:* `String.t`, *default:* `nil`) - Output only. Immutable. MerchantCenterAccountLink identifier, which is the final component of name. This field is auto generated and follows the convention: `BranchId_MerchantCenterAccountId`. `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/id_1`.
  *   `languageCode` (*type:* `String.t`, *default:* `nil`) - Language of the title/description and other string attributes. Use language tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). ISO 639-1. This specifies the language of offers in Merchant Center that will be accepted. If empty, no language filtering will be performed. Example value: `en`.
  *   `merchantCenterAccountId` (*type:* `String.t`, *default:* `nil`) - Required. The linked [Merchant center account id](https://developers.google.com/shopping-content/guides/accountstatuses). The account must be a standalone account or a sub-account of a MCA.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Immutable. Full resource name of the Merchant Center Account Link, such as `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/merchant_center_account_link`.
  *   `projectId` (*type:* `String.t`, *default:* `nil`) - Output only. Google Cloud project ID.
  *   `source` (*type:* `String.t`, *default:* `nil`) - Optional. An optional arbitrary string that could be used as a tag for tracking link source.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. Represents the state of the link.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :branchId => String.t() | nil,
          :feedFilters =>
            list(
              GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLinkMerchantCenterFeedFilter.t()
            )
            | nil,
          :feedLabel => String.t() | nil,
          :id => String.t() | nil,
          :languageCode => String.t() | nil,
          :merchantCenterAccountId => String.t() | nil,
          :name => String.t() | nil,
          :projectId => String.t() | nil,
          :source => String.t() | nil,
          :state => String.t() | nil
        }

  field(:branchId)

  field(:feedFilters,
    as:
      GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLinkMerchantCenterFeedFilter,
    type: :list
  )

  field(:feedLabel)
  field(:id)
  field(:languageCode)
  field(:merchantCenterAccountId)
  field(:name)
  field(:projectId)
  field(:source)
  field(:state)
end

defimpl Poison.Decoder,
  for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLink do
  def decode(value, options) do
    GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLink.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Retail.V2.Model.GoogleCloudRetailV2alphaMerchantCenterAccountLink do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
