/*********************************************************************
 * \file   File.hpp
 *
 * \author Romain BOULLARD
 * \date   December 2025
 *********************************************************************/
#ifndef BIGFOOT_SYSTEM_FILE_HPP
#define BIGFOOT_SYSTEM_FILE_HPP

#include <EASTL/string.h>
#include <EASTL/string_view.h>

#include <filesystem>

namespace Bigfoot
{
class File
{
  public:
    /**
     * Constructor
     *
     * \param p_path The path
     */
    File(const eastl::string_view p_path);

    File(const File& p_path) = default;
    File(File&& p_path) = default;

    /**
     * Check if the file is relative to the current executable
     *
     * \return True if the file is relative, false otherwise
     */
    [[nodiscard]]
    bool IsRelative() const;

    /**
     * Check if the file is absolute
     *
     * \return True if the file is absolute, false otherwise
     */
    [[nodiscard]]
    bool IsAbsolute() const;

    /**
     * Check if the file exists
     *
     * \return True if it exists, false otherwise
     */
    [[nodiscard]]
    bool Exists() const;

    /**
     * Get the file path
     *
     * \return The path
     */
    [[nodiscard]]
    eastl::string_view GetPath() const;

    /**
     * Get the same file, relative to the current executable
     *
     * \return The relative file
     */
    [[nodiscard]]
    File ToRelative() const;

    /**
     * Get the same file, with an absolute path
     *
     * \return The absolute file
     */
    [[nodiscard]]
    File ToAbsolute() const;

    ~File() = default;

    File& operator=(const File& p_path) = default;
    File& operator=(File&& p_path) = default;

  private:
    /**
     * Constructor
     *
     * \param p_path The path
     */
    File(const std::filesystem::path& p_path);

    /**
     * The path
     */
    std::filesystem::path m_path;

    /*
     * The path as a string
     */
    eastl::string m_pathString;
};
}   // namespace Bigfoot

#endif
