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

#pragma once
#include "scene/SceneItemComponent.hpp"
#include "TicTacToeTile.hpp"
#include "physics/3d/Ray3D.hpp"

namespace Dawn {
  class TicTacToeGame : public SceneItemComponent {
    public:
      enum TicTacToeTileState winner;
      StateProperty<bool_t> gameOver;
      std::map<int32_t, TicTacToeTile*> tiles;
      StateProperty<enum TicTacToeTileState> nextMove;
      StateProperty<int32_t> scoreCross;
      StateProperty<int32_t> scoreNought;

      TicTacToeGame(SceneItem *item);

      std::map<uint8_t, enum TicTacToeTileState> getBoard();
      void makeMove(uint8_t tile, enum TicTacToeTileState player);

      void onStart() override;
  };
}