#ifndef SCRIPTS_H
#define SCRIPTS_H

#include "buysell.h"
#include "dispatchers.h"
#include "galaxy.h"

class ScriptTrader : public Dispatch {
 private:
 public:
  ScriptTrader(Director &);
  ~ScriptTrader();

  char foe[4] = "foe";
  bool trade_end_empty;

  /**
   * internal state
   *
   * 1 = <Info> query.
   * 2 = move to active port
   * 3 = trade
   * 4 = if (burnt), stop, otherwise toggle active_port and state = 2
   *
   * NEW: set port[1] to 0 for buy-only ability.
   * Percent 20 doesn't work with Cargo Trans' 250 holds.
   * Maybe look at the amount instead?  If < holds = burnt.
   */
  int state;
  float percent;
  bool buying;
  int initial_offer;
  int last_offer;
  int final_offer;
  int product; // product we are buying/selling 0,1,2 foe.
  int stop_percent;

  // should this be 0/1 ?  right now it is the port's sector number.
  int active_port;  // port trading with
  // information from the find_best_trades function + others.
  int port[2];
  int active;
  // I don't care about trade type, just trades.
  int type;
  
  buysell trades;
  buysell port_buysell[2];

  void activate(void) override;
  void deactivate(void) override;

  void server_line(const std::string &line,
                   const std::string &raw_line) override;
  void server_prompt(const std::string &prompt) override;
  void client_input(const std::string &cinput) override;
};

#endif