Skip to main content

lib/chat_code/wardrobe_template/skin.ex

defmodule GW2.ChatCode.WardrobeTemplate.Skin do
  @moduledoc """
  Represents a skin inside a wardrobe template.

  A wardrobe template slot can contain a skin entry, or be `nil` when the slot
  is empty. Each skin entry stores the skin id, whether the slot is visible,
  and optionally four dye channel ids.

  ## Fields

    * `:id` - the skin id for the slot.
    * `:dyes` - four dye ids for slots that support dyes, or `nil` for skins
      that do not support dye channels. When encoding dye-capable slots, `nil`
      is written as four Dye Remover ids (`1`).
    * `:visible?` - whether the slot is marked as visible. Defaults to `true`.

  """

  @typedoc "A skin entry for one wardrobe template slot."
  @type t :: %__MODULE__{
          id: non_neg_integer(),
          dyes: [non_neg_integer()] | nil,
          visible?: boolean()
        }

  @enforce_keys [:id]
  defstruct [
    :id,
    dyes: nil,
    visible?: true
  ]
end