package org.mcupdater.model;

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


public class Module extends GenericModule {
	private List<ConfigFile> configs = new ArrayList<>();
	private List<GenericModule> submodules = new ArrayList<>();
	
	public Module(String name, String id, List<PrioritizedURL> url, String depends, boolean required, boolean inJar, int jarOrder, boolean keepMeta, boolean extract, boolean inRoot, boolean isDefault, boolean coreMod, String md5, List<ConfigFile> configs, String side, String path, HashMap<String, String> meta, boolean isLibrary, boolean litemod, String launchArgs, String jreArgs, List<GenericModule> submodules){
		super(name,id,url,depends,required,inJar,jarOrder,keepMeta,extract,inRoot,isDefault,coreMod,md5,side,path,meta,isLibrary,litemod,launchArgs,jreArgs);	
		if(configs != null)
		{
			this.configs = configs;
		} else {
			this.configs = new ArrayList<>();
		}
		this.submodules.addAll(submodules);
	}

	@Deprecated
	public Module(String name, String id, List<PrioritizedURL> url, String depends, boolean required, boolean inJar, int jarOrder, boolean keepMeta, boolean extract, boolean inRoot, boolean isDefault, boolean coreMod, String md5, List<ConfigFile> configs, String side, String path, HashMap<String, String> meta){
		this(name,id,url,depends,required,inJar,jarOrder,keepMeta,extract,inRoot,isDefault,coreMod,md5,configs,side,path,meta,false,false,null,null,null);
	}

	@Deprecated
	public Module(String name, String id, String url, String depends, boolean required, boolean inJar, boolean extract, boolean inRoot, boolean isDefault, boolean coreMod, String md5, List<ConfigFile> configs)
	{
		this(name, id, makeList(url), depends, required, inJar, 0, true, extract, inRoot, isDefault, coreMod, md5, configs, null, null, null);
	}
	
	private static List<PrioritizedURL> makeList(String url) {
		List<PrioritizedURL> urls = new ArrayList<>();
		urls.add(new PrioritizedURL(url, 0));
		return urls;
	}

	public List<ConfigFile> getConfigs()
	{
		return configs;
	}
	
	public void setConfigs(List<ConfigFile> configs)
	{
		this.configs = configs;
	}
	
	public boolean hasConfigs() {
		return (this.configs.size() > 0);
	}
	
	public boolean hasSubmodules() {
		return (this.submodules.size() > 0);
	}
	
	public List<GenericModule> getSubmodules() {
		return this.submodules;
	}

}


@@ -981,1017 +981,8 @@
 %09%7D%0A%0A
-%09@Deprecated%0A%09public Module(String name, String id, List%3CPrioritizedURL%3E url, String depends, boolean required, boolean inJar, int jarOrder, boolean keepMeta, boolean extract, boolean inRoot, boolean isDefault, boolean coreMod, String md5, List%3CConfigFile%3E configs, String side, String path, HashMap%3CString, String%3E meta)%7B%0A%09%09this(name,id,url,depends,required,inJar,jarOrder,keepMeta,extract,inRoot,isDefault,coreMod,md5,configs,side,path,meta,false,false,null,null,null);%0A%09%7D%0A%0A%09@Deprecated%0A%09public Module(String name, String id, String url, String depends, boolean required, boolean inJar, boolean extract, boolean inRoot, boolean isDefault, boolean coreMod, String md5, List%3CConfigFile%3E configs)%0A%09%7B%0A%09%09this(name, id, makeList(url), depends, required, inJar, 0, true, extract, inRoot, isDefault, coreMod, md5, configs, null, null, null);%0A%09%7D%0A%09%0A%09private static List%3CPrioritizedURL%3E makeList(String url) %7B%0A%09%09List%3CPrioritizedURL%3E urls = new ArrayList%3C%3E();%0A%09%09urls.add(new PrioritizedURL(url, 0));%0A%09%09return urls;%0A%09%7D%0A%0A
 %09pub

Remove deprecated ServerList constructors