#include "subfiles/oggsubfile.h"

#include "EasyLogging++/easylogging++.h"

namespace LOTRO_DAT {
namespace Subfiles {

SubfileData Subfile<OGG>::BuildForExport(const BinaryData &file_data) {
    SubfileData result;
    result.binary_data = file_data.CutData(8);
    result.options["ext"] = ".ogg";
    return result;
}

BinaryData Subfile<OGG>::BuildForImport(const BinaryData &, const SubfileData &data) {
    BinaryData file_size = BinaryData::FromNumber<4>(data.binary_data.size() - 8);
    BinaryData file_id = BinaryData::FromNumber<4>(data.options["fid"].as<int>());

    return file_id + file_size + data.binary_data;
}

}; // namespace Subfiles
}; // namespace LOTRO_DAT