     |> PaperTrail.RepoClient.repo().one
   end
 
-  @spec get_version(model :: module, id :: pos_integer, options :: []) :: Ecto.Query.t()
+  @spec get_version(model :: module, id :: pos_integer, options :: []) :: Version.t() | nil
   def get_version(model, id, options) do
     item_type = model |> Module.split() |> List.last()
     last(version_query(item_type, id, options)) |> PaperTrail.RepoClient.repo().one

    iex(1)> PaperTrail.VersionQueries.get_versions(ModelName, id)
    iex(1)> PaperTrail.VersionQueries.get_versions(ModelName, id, [prefix: "tenant_id"])
  """
  @spec get_versions(record :: Ecto.Schema.t()) :: Ecto.Query.t()
  def get_versions(record), do: get_versions(record, [])

  @doc """
  Gets all the versions of a record given a module and its id
  """
  @spec get_versions(model :: module, id :: pos_integer) :: Ecto.Query.t()
  def get_versions(model, id) when is_atom(model) and is_integer(id),
    do: get_versions(model, id, [])

  @spec get_versions(record :: Ecto.Schema.t(), options :: []) :: Ecto.Query.t()
  def get_versions(record, options) when is_map(record) do
    item_type = record.__struct__ |> Module.split() |> List.last()


    |> PaperTrail.RepoClient.repo().all
  end

  @spec get_versions(model :: module, id :: pos_integer, options :: []) :: [Version.t()]
  def get_versions(model, id, options) do
    item_type = model |> Module.split() |> List.last()
    version_query(item_type, id, options) |> PaperTrail.RepoClient.repo().all
