#pragma once
#include "types.hpp"



enum class BinaryFormat
{
    PE,
    ELF,
    UNKNOWN
};

enum class Arch
{
    X86,
    X64,
    UNKNOWN
};

class Binary
{
    public:
        virtual ~Binary() = default;
        virtual bool load(const string& path) = 0;
        virtual BinaryFormat getFormat() const = 0;
        virtual Arch getArch() const = 0;
        virtual addr_t getEntryPoint() const = 0;
        virtual addr_t getImageBase() const = 0;
        virtual vector<uint8_t> readBytes(addr_t vaddr, size_t size) const = 0;
        virtual vector<pair<addr_t, addr_t>> getExecutableRanges() const = 0;
        virtual vector<pair<addr_t, addr_t>> getDataRanges() const
        {
            return {};
        }
        virtual vector<pair<addr_t, addr_t>> getRuntimeFunctions() const
        {
            return {};
        }
        virtual vector<pair<addr_t, string>> getExportedFunctions() const = 0;
        virtual vector<ImportEntry> getImportedFunctions() const
        {
            return {};
        }
        virtual const string& getPath() const = 0;

        static unique_ptr<Binary> create(const string& path);
};
