# 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.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Setting do
  @moduledoc """
  The schema for settings.

  ## Attributes

  *   `effectiveValue` (*type:* `GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value.t`, *default:* `nil`) - Output only. The effective value of the setting at the given parent resource, evaluated based on the resource hierarchy The effective value evaluates to one of the following options, in this order. If an option is not valid or doesn't exist, then the next option is used: 1. The local setting value on the given resource: Setting.local_value 2. If one of the given resource's ancestors in the resource hierarchy have a local setting value, the local value at the nearest such ancestor. 3. The setting's default value: SettingMetadata.default_value 4. An empty value, defined as a `Value` with all fields unset. The data type of Value must always be consistent with the data type defined in Setting.metadata.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - A fingerprint used for optimistic concurrency. See UpdateSetting for more details.
  *   `localValue` (*type:* `GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value.t`, *default:* `nil`) - The configured value of the setting at the given parent resource, ignoring the resource hierarchy. The data type of Value must always be consistent with the data type defined in Setting.metadata.
  *   `metadata` (*type:* `GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1SettingMetadata.t`, *default:* `nil`) - Output only. Metadata about a setting which is not editable by the end user.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the setting. Must be in one of the following forms: * `projects/{project_number}/settings/{setting_name}` * `folders/{folder_id}/settings/{setting_name}` * `organizations/{organization_id}/settings/{setting_name}` For example, "/projects/123/settings/gcp-enableMyFeature"
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :effectiveValue =>
            GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value.t() | nil,
          :etag => String.t() | nil,
          :localValue =>
            GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value.t() | nil,
          :metadata =>
            GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1SettingMetadata.t()
            | nil,
          :name => String.t() | nil
        }

  field(:effectiveValue,
    as: GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value
  )

  field(:etag)
  field(:localValue, as: GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Value)

  field(:metadata,
    as: GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1SettingMetadata
  )

  field(:name)
end

defimpl Poison.Decoder,
  for: GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Setting do
  def decode(value, options) do
    GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Setting.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ResourceSettings.V1.Model.GoogleCloudResourcesettingsV1Setting do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
