lib/mbta/model/alert_resource.ex

# NOTE: This file is auto generated by OpenAPI Generator 7.1.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule MBTA.Model.AlertResource do
  @moduledoc """
  An effect (enumerated in `*/attributes/effect` and human-readable in `*/attributes/service_effect`) on a provided service (facility, route, route type, stop and/or trip in `/*/attributes/informed_entity`) described by a banner (`*/attributes/banner`), short header (`*/attributes/short_header`), header `*/attributes/header`, description (`*/attributes/description`), image (`*/attributes/image`), and image alternative text (`*/attributes/image_alternative_text`) that is active for one or more periods(`*/attributes/active_period`) caused by a cause (`*/attribute/cause`) that somewhere in its lifecycle (enumerated in `*/attributes/lifecycle` and human-readable in `*/attributes/timeframe`).  See [GTFS Realtime `FeedMessage` `FeedEntity` `Alert`](https://github.com/google/transit/blob/master/gtfs-realtime/spec/en/reference.md#message-alert)  ## Descriptions  There are 7 descriptive attributes.  | JSON pointer                                | Usage                                                                           | |---------------------------------------------|---------------------------------------------------------------------------------| | `*/attributes/banner`       | Display as alert across application/website                                     | | `*/attributes/short_header` | When `*/attributes/header` is too long to display               | | `*/attributes/header`       | Used before showing and prepended to `*/attributes/description` | | `*/attributes/description`  | Used when user asks to expand alert.                                            | | `*/attributes/image`        | URL to descriptive image.                                                       | | `*/attributes/image_alternative_text`  | Text that describes image linked in url                              |  ## Effect  | JSON pointer                                  |                | |-----------------------------------------------|----------------| | `*/attributes/effect`         | Enumerated     | | `*/attributes/service_effect` | Human-readable |  ## Timeline  There are 3 timeline related attributes  | JSON pointer                                 | Description                                                                              | |----------------------------------------------|------------------------------------------------------------------------------------------| | `*/attributes/active_period` | Exact Date/Time ranges alert is active                                                   | | `*/attributes/lifecycle`     | Enumerated, machine-readable description of `*/attributes/active_period` | | `*/attributes/timeframe`     | Human-readable description of `*/attributes/active_period`               | 
  """

  @derive Jason.Encoder
  defstruct [
    :type,
    :relationships,
    :links,
    :id,
    :attributes
  ]

  @type t :: %__MODULE__{
    :type => String.t | nil,
    :relationships => MBTA.Model.AlertResourceRelationships.t | nil,
    :links => map() | nil,
    :id => String.t | nil,
    :attributes => MBTA.Model.AlertResourceAttributes.t | nil
  }

  alias MBTA.Deserializer

  def decode(value) do
    value
     |> Deserializer.deserialize(:relationships, :struct, MBTA.Model.AlertResourceRelationships)
     |> Deserializer.deserialize(:attributes, :struct, MBTA.Model.AlertResourceAttributes)
  end
end