# 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.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Tree do
  @moduledoc """
  A `Tree` contains all the Directory protos in a single directory Merkle tree, compressed into one message.

  ## Attributes

  *   `children` (*type:* `list(GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory.t)`, *default:* `nil`) - All the child directories: the directories referred to by the root and, recursively, all its children. In order to reconstruct the directory tree, the client must take the digests of each of the child directories and then build up a tree starting from the `root`.
  *   `root` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory.t`, *default:* `nil`) - The root directory in the tree.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :children =>
            list(GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory.t())
            | nil,
          :root =>
            GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory.t() | nil
        }

  field(:children,
    as: GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory,
    type: :list
  )

  field(:root, as: GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Directory)
end

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

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