#ifndef _HF_GAME_
#define _HF_GAME_

#include <stdbool.h>

typedef struct Game Game;

#include "card.h"
#include "field_multiplier.h"
#include "teyaku.h"

typedef enum GameState {
  GAME_STATE_INITIALIZING,
  GAME_STATE_DEALING,
  GAME_STATE_CALCULATING_FIELD_MULTIPLIER,
  GAME_STATE_CALCULATING_TEYAKU,
  GAME_STATE_PLAYER_CHOOSING_FROM_HAND,
  GAME_STATE_PLAYER_CHOOSING_TARGET,
  GAME_STATE_PLAYER_FROM_DECK,
  GAME_STATE_RIGHT_PLAYING,
  GAME_STATE_RIGHT_FROM_DECK,
  GAME_STATE_LEFT_PLAYING,
  GAME_STATE_LEFT_FROM_DECK,
} GameState;

struct Game {
  GameState state;
  bool should_close;
  Card cards[48];
  Texture2D cards_texture;
  Hand player_hand, left_hand, right_hand;
  Hand deck, field;
  Hand player_scored, left_scored, right_scored;
  FieldMultiplier *field_multiplier;
  Teyaku player_teyaku, left_teyaku, right_teyaku;
  Card *current_play_from_hand, *current_play_target;
};

void initialize_game(Game *g);
void run_until_closing(Game *g);

#endif