#pragma once

#include <tinyxml2.h>
#include <vector>
#include <string>
#include "def.h"
#include "effect.h"

namespace render{
namespace fx{

class collection
{
public:
    effect *createEffect(const std::string&);
    std::shared_ptr<effect> &createSharedEffect(const std::string&);
    object *createObject(const std::string &id, float, effect*) const;

    const effectInfo *getEffectDef(const std::string &id);

    const render::sprite::textureAtlas *getAtlas(const std::string &id) const;
    const objectInfo *getObject(const std::string &id) const;
    bool load(const std::string&);

    std::vector<effectInfo> data;
    std::vector<objectInfo*> objects;
    std::vector<textureAtlasInfo> atlases;
private:
    void loadAtlases(tinyxml2::XMLElement*);
    void loadObjects(tinyxml2::XMLElement*);
    void loadEffects(tinyxml2::XMLElement*);
};

}}
