# 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.AnalyticsData.V1alpha.Model.CohortsRange do
  @moduledoc """
  Configures the extended reporting date range for a cohort report. Specifies an offset duration to follow the cohorts over.

  ## Attributes

  *   `endOffset` (*type:* `integer()`, *default:* `nil`) - Required. `endOffset` specifies the end date of the extended reporting date range for a cohort report. `endOffset` can be any positive integer but is commonly set to 5 to 10 so that reports contain data on the cohort for the next several granularity time periods. If `granularity` is `DAILY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset` days. If `granularity` is `WEEKLY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset * 7` days. If `granularity` is `MONTHLY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset * 30` days.
  *   `granularity` (*type:* `String.t`, *default:* `nil`) - Required. The granularity used to interpret the `startOffset` and `endOffset` for the extended reporting date range for a cohort report.
  *   `startOffset` (*type:* `integer()`, *default:* `nil`) - `startOffset` specifies the start date of the extended reporting date range for a cohort report. `startOffset` is commonly set to 0 so that reports contain data from the acquisition of the cohort forward. If `granularity` is `DAILY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset` days. If `granularity` is `WEEKLY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset * 7` days. If `granularity` is `MONTHLY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset * 30` days.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :endOffset => integer() | nil,
          :granularity => String.t() | nil,
          :startOffset => integer() | nil
        }

  field(:endOffset)
  field(:granularity)
  field(:startOffset)
end

defimpl Poison.Decoder, for: GoogleApi.AnalyticsData.V1alpha.Model.CohortsRange do
  def decode(value, options) do
    GoogleApi.AnalyticsData.V1alpha.Model.CohortsRange.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AnalyticsData.V1alpha.Model.CohortsRange do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
