#pragma once

#include "FileAddressList.hpp"

namespace tw::app {

/**
 * Manages a list of favourite server addresses.
 *
 * Persists addresses to a text file, one "ip:port" per line.
 * Appended in the order they are added, de-duplicated,
 * capped at 32 entries. File path is
 * $XDG_CONFIG_HOME/towards/favourite_servers.txt, falling back to
 * $HOME/.config/towards/favourite_servers.txt. If both variables are
 * unset, keeps the list in memory only.
 */
class FavouriteServers : public FileAddressList {
    static constexpr size_t MAX_ENTRIES = 32;

public:
    FavouriteServers();

    const char* name() const override;

    /**
     * Add an address to the favourites list.
     * Appended at the end if not already present, capped at 32.
     * Does not persist to disk; call save() after modifying.
     */
    void add(const std::string& entry) override;
};

} // namespace tw::app
