diff --git a/apps/transport/lib/registry/model/data_source.ex b/apps/transport/lib/registry/model/data_source.ex new file mode 100644 index 0000000000..d985325ce9 --- /dev/null +++ b/apps/transport/lib/registry/model/data_source.ex @@ -0,0 +1,23 @@ +defmodule Transport.Registry.Model.DataSource do + @moduledoc """ + Common attributes describing a data source. + """ + + defstruct [ + :id, + :checksum, + :last_updated_at, + :validity_period + ] + + @type t :: %__MODULE__{ + id: data_source_id(), + checksum: binary(), + last_updated_at: DateTime.t(), + validity_period: date_time_range() + } + + @type data_source_id :: binary() + + @type date_time_range :: binary() +end diff --git a/apps/transport/lib/registry/model/stop.ex b/apps/transport/lib/registry/model/stop.ex new file mode 100644 index 0000000000..50c069818f --- /dev/null +++ b/apps/transport/lib/registry/model/stop.ex @@ -0,0 +1,57 @@ +defmodule Transport.Registry.Model.StopIdentifier do + @moduledoc """ + Representation of a Stop ID. + """ + + defstruct [ + :id, + :type + ] + + @type t :: %__MODULE__{ + id: binary(), + type: identifier_type() + } + + @type identifier_type :: :main | :private_code | :stop_code | :other +end + +defmodule Transport.Registry.Model.Stop do + @moduledoc """ + Common attributes describing a stop. + """ + alias Transport.Registry.Model.DataSource + alias Transport.Registry.Model.StopIdentifier + + defstruct [ + :main_id, + :display_name, + :data_source_id, + :data_source_format, + :parent_id, + :latitude, + :longitude, + projection: :utm_wgs84, + stop_type: :stop, + secondary_ids: [] + ] + + @type t :: %__MODULE__{ + main_id: StopIdentifier.t(), + display_name: binary(), + data_source_id: DataSource.data_source_id(), + data_source_format: data_source_format_type(), + parent_id: StopIdentifier.t() | nil, + latitude: float(), + longitude: float(), + projection: projection(), + stop_type: stop_type(), + secondary_ids: [StopIdentifier.t()] + } + + @type data_source_format_type :: :gtfs | :netex + + @type stop_type :: :stop | :quay | :other + + @type projection :: :utm_wgs84 | :lambert93_rgf93 +end