package org.project.location;

import org.project.entity.enemies.*;
import java.io.Serializable;
import java.util.ArrayList;

public class Location implements Serializable
{
    private static final long serialVersionUID = 1L;

    private String name;
    private String description;
    private int difficulty; // 1 = easy, 2 = medium, 3 = hard
    private ArrayList<Location> connectedLocations;

    public Location(String name, String description, int difficulty)
    {
        this.name = name;
        this.description = description;
        this.difficulty = difficulty;
        this.connectedLocations = new ArrayList<>();
    }

    public void connectLocation(Location location)
    {
        connectedLocations.add(location);
    }

    public ArrayList<Location> getConnectedLocations()
    {
        return connectedLocations;
    }

    public String getName()
    {
        return name;
    }

    public int getDifficulty()
    {
        return difficulty;
    }

    public void enter()
    {
        System.out.println("\n==============================");
        System.out.println("📍 You arrived at: " + name);
        System.out.println(description);
        System.out.println("Difficulty: " + difficulty);
        System.out.println("==============================\n");
    }

    public Enemy spawnEnemy()
    {
        return switch (name)
        {
            case "Forest" -> new Goblin();
            case "Graveyard" -> new Skeleton();
            case "Vampire Crypt" -> new Vampire();
            case "Dragon Castle" -> new Dragon();
            default -> new Goblin();
        };
    }
}
