defmodule BwcWeb.LayoutView do
  use BwcWeb, :view

  def show_username(%Ecto.Changeset{} = player) do
    cond do
      player.valid? ->
        player.username
      true ->
        Nobody
      end
  end

  def show_username(%Bwc.Player{} = player) do
    player.username
  end

  def show_username("Nobody" = player) do
    "Nobody"
  end

  def show_username(nil = player) do
    "Nobody"
  end

end
