package pathgame.logging;

import pathgame.algorithm.SaleRoute;
import pathgame.gameplay.Player;
import pathgame.tilemap.TileMap;

import java.util.ArrayList;

public class Logger
{
    public static void onLevelReset(int level, Player p, TileMap map)
    {
        System.out.println("Level Reset " + level);
    }
    
    public static void onTileEnter(Player p, TileMap map, int x, int y)
    {
        System.out.println("Tile Enter " + x + " " + y);
    }
    
    public static void onTileLeave(Player p, TileMap map, int x, int y)
    {
        System.out.println("Tile Leave " + x + " " + y);
    }
    
    public static void onWin(Player p, TileMap map)
    {
        System.out.println("Win");
    }

    public static void onAlgoDone(ArrayList<ArrayList<SaleRoute>> salesPitch, ArrayList<Integer> eulerTour) {
        System.out.println("algorithm done");
        /*TODO: follow the eulerTour, getting salesPitch.get(x).get(y).get(path)
          TODO: and getting the x and y value of each coord in that list and logging them*/
        /*x and y correspond indirectly to values of the eulerTour
        * salesPitch is structured like so:
        *          [town0]  [town1]  [town2]  [town3] ...
        * [town0]     -     x:0/y:0  x:0/y:1  x:0/y:2
        * [town1]     -        -     x:1/y:0  x:1/y:1
        * [town2]     -        -        -     x:2/y:0
        * [town3]     -        -        -        -
        * ...*/
        /*so to get the path between node 0 and 1 use salesPitch.get(0).get(0).get(path);
        * (x is equal to [townRowIndex], y is equal to [townColIndex] - x - 1 (!!!))
        * note that paths between x and y are equal to paths between y and x, but only one can be found in salesPitch
        * so the path between 0 - 1 and 1 - 0 are the same, but only 0 - 1 can be accessed
        * make sure that x <= y to not go out of bounds*/

        /*Example eulerTour: 3, 0, 1, 2, 3
        * Therefore, the paths logged need to be:
        * salesPitch.get(0).get(2).get(path)
        * salesPitch.get(0).get(0).get(path)
        * salesPitch.get(1).get(0).get(path)
        * salesPitch.get(2).get(0).get(path)
        * */

        /*NOTE: for visual representation, algorithm coordinates don't have to be logged in order
        * for the final representation to be correct. If the end-output is a list of coordinates, though,
        * it may be necessary to order the coordinates to form a continuous path*/
    }
}
