package org.sillyjirafe.uoapi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
import org.sillyjirafe.uoapi.binds.GitHubMITApi;
import org.sillyjirafe.uoapi.binds.OpenVerseAudiosApi;
import org.sillyjirafe.uoapi.binds.OpenVerseImagesApi;

public class Out {
	List<Api> Apis = new ArrayList<>();
	
	public List<String> PreOut()
	{
		Apis.add(new GitHubMITApi());
        Apis.add(new GitHubLGPLApi());
        Apis.add(new GitHubApacheApi());
        Apis.add(new OpenVerseImagesApi());
        Apis.add(new OpenVerseAudiosApi());
        
        List<String> bindnames = new ArrayList<>();
        
        for (Api api : Apis)
        {
        	bindnames.add(api.getName());
        }
        
        return bindnames;
	}
	
    public List<element> out(Map<String, Integer> bindpages) throws Exception
    {
        List<element> Elements = new ArrayList<>();
        
        for (int i = 0; i < Apis.size(); i++)
        {
        	List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()));
            for (int j = 0; j < currentapi.size(); j++)
            {
                Elements.add(currentapi.get(j));
            }
        }
        return Elements;
    }
}
