# 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.HealthCare.V1.Model.Segment do
  @moduledoc """
  A segment in a structured format.

  ## Attributes

  *   `fields` (*type:* `map()`, *default:* `nil`) - A mapping from the positional location to the value. The key string uses zero-based indexes separated by dots to identify Fields, components and sub-components. A bracket notation is also used to identify different instances of a repeated field. Regex for key: (\\d+)(\\[\\d+\\])?(.\\d+)?(.\\d+)? Examples of (key, value) pairs: * (0.1, "hemoglobin") denotes that the first component of Field 0 has the value "hemoglobin". * (1.1.2, "CBC") denotes that the second sub-component of the first component of Field 1 has the value "CBC". * (1[0].1, "HbA1c") denotes that the first component of the first Instance of Field 1, which is repeated, has the value "HbA1c".
  *   `segmentId` (*type:* `String.t`, *default:* `nil`) - A string that indicates the type of segment. For example, EVN or PID.
  *   `setId` (*type:* `String.t`, *default:* `nil`) - Set ID for segments that can be in a set. This can be empty if it's missing or isn't applicable.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fields => map() | nil,
          :segmentId => String.t() | nil,
          :setId => String.t() | nil
        }

  field(:fields, type: :map)
  field(:segmentId)
  field(:setId)
end

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

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