// Copyright (c) 2022 Dominic Masters
// 
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT

#pragma once
#include "ui/UILabel.hpp"
#include "ui/UIEmpty.hpp"
#include "ui/UIBorder.hpp"
#include "poker/PokerPlayer.hpp"
#include "asset/AssetManager.hpp"
#include "asset/assets/TrueTypeAsset.hpp"
#include "display/animation/SimpleAnimation.hpp"
#include "ui/PokerGameBorder.hpp"

namespace Dawn {
  class PokerPlayerDisplay : public UIEmpty {
    private:
      SimpleAnimation<int32_t> animChips;
      int32_t animChipsValue;

    protected:
      PokerPlayer *player = nullptr;
      UILabel labelName;
      UILabel labelChips;
      UIEmpty borderInner;
      UIBorder border;

      TrueTypeAsset *font;

      void onPlayerChipsChanged();
      void onSceneUpdate();

    public:
      static std::vector<Asset*> getAssets(AssetManager *assMan) {
        std::vector<Asset*> assets;
        assets = PokerGameBorder::getAssets(assMan);
        assets.push_back(assMan->get<TrueTypeAsset>("truetype_alice"));
        return assets;
      }

      PokerPlayerDisplay(UICanvas *canvas);

      void setPlayer(PokerPlayer *player);

      ~PokerPlayerDisplay();
  };
}