#pragma once

#include <map>
#include <string>
#include "StringUtils.h"

class FileFormat{

public:
    enum class Encoding{
        Ascii,
        UTF8,
        Binary
    };

    enum class Format{
        Html,
        Xml,
        Markdown,
        Pdf,
        Json,
        Png,
        Wav,
        Midi,
        Unknown
    };

    using ExtensionMap = std::map<Format, std::string>;

private:
    static ExtensionMap mExtensions;

public:

    bool IsFormat(const std::string& extension, Format format)
    {
        return StringUtils::ToLower(extension) == mExtensions[format];
    }

    static Format InferFormat(const std::string& query)
    {
        for(const auto& extension : mExtensions)
        {
            if(extension.second == query)
            {
                return extension.first;
            }
        }
        return Format::Unknown;
    }

    std::string GetExtension(Format format)
    {
        return mExtensions[format];
    }
};

