#ifndef ATTACKPATH_H
#define ATTACKPATH_H

#include "../interface/HitBox.h"

#include <string>
#include <vector>
using namespace std;

#define ATTACK_PATH_DRAW_PREVIEW 0
#define ATTACK_PATH_DRAW_SINGLE 1
#define ATTACK_PATH_DRAW_LINE_SEGMENT 2

//AttackPath stores the information needed to trace the mouse across to score a sucessful hit.

class AttackPath {
 public:
  AttackPath();
  ~AttackPath();

  //set parameters. Returns false if invalid.
  bool setInitialRadius (uint8_t);
  uint8_t getInitialRadius ();
  bool setBounds (uint16_t w, uint16_t h);
  bool setAxis (int x, int y);
  bool addPoint (int x, int y);
  uint8_t getCurrentRadius (int timeElapsed = 0);
  int getNumberOfPoints();

  //The user has a certain amount of time to draw each segment.
  void setTimePerSegment(int);
  int getTimePerSegment();

  bool validateAndInitialize();
  bool isValid();

  //Tell the attack path to only show the first point.
  vector <HitBox> :: iterator getFirstPoint ();

  //clear everything
  void clear();

  //This is used to return visual data.
  void drawPreview (vector<HitBox*> & points2, vector<int> & lines, vector<int> & pointer);
  void drawTwoPoints (int index, vector<HitBox*>& points2, vector<int>& segment, int startTime);
  void drawOnlyFirstPoint (int, vector<HitBox*>& points2);
 private:
  bool validate();
  //Given a direction and distance, create two points that are perpendicular to the origin
  int generatePerpendicularPoints(int directionX, int directionY, int distance, vector <FixedInt> & ans);
  //Given two points and the distance, create the rectangle that has those two points on its sides and is distance away.
  int generateRectangleBasedOnPoints (int ax, int ay, int bx, int by, int distance, vector<FixedInt> & ans);

  bool attackPathIsValid;
  int axisX, axisY;
  uint8_t radius;
  uint16_t boundsW, boundsH;
  vector <HitBox> points;
  int timePerSegment;
};

#endif
