package client.gui;

import client.vars.CVarCategory;
import client.vars.Variable;
import client.vars.Variable.IntType;
import common.util.Displayable;
import common.util.Identifyable;

public enum Style implements Identifyable, Displayable {
	DEFAULT("default", "Standard"), SHINY("shiny", "Glänzend"), GRAY("gray", "Grau"), BLUE("blue", "Blau"), CUSTOM("custom", "Angepasst");

	public final String id;
	public final String name;
	
	private Style(String id, String name) {
		this.id = id;
		this.name = name;
	}

	@Variable(type = IntType.COLOR, name = "color_border_top", category = CVarCategory.GUI, display = "Umrahmung A")
	public int brdr_top;
	@Variable(type = IntType.COLOR, name = "color_border_btm", category = CVarCategory.GUI, display = "Umrahmung B")
	public int brdr_btm;

	@Variable(type = IntType.COLOR, name = "color_button_top", category = CVarCategory.GUI, display = "Knopf oben")
	public int fill_top;
	@Variable(type = IntType.COLOR, name = "color_button_btm", category = CVarCategory.GUI, display = "Knopf unten")
	public int fill_btm;
	@Variable(type = IntType.COLOR, name = "color_textbox_top", category = CVarCategory.GUI, display = "Eingabe oben")
	public int field_top;
	@Variable(type = IntType.COLOR, name = "color_textbox_btm", category = CVarCategory.GUI, display = "Eingabe unten")
	public int field_btm;

	@Variable(type = IntType.COLOR, name = "color_label_text", category = CVarCategory.GUI, display = "Beschriftung")
	public int text_label;
	@Variable(type = IntType.COLOR, name = "color_button_text", category = CVarCategory.GUI, display = "Knopf Text")
	public int text_base;
	@Variable(type = IntType.COLOR, name = "color_textbox_text", category = CVarCategory.GUI, display = "Eingabe Text")
	public int text_field;
	
	static {
		DEFAULT
			.border(0xa0a0a0, 0x202020)
			.base(0x606060, 0x404040, 0xffffff, 0xefefef)
			.field(0x000000, 0x101010, 0xffffff);
		
		SHINY
			.border(0xffffff, 0x3f3f3f)
			.base(0x404040, 0x000000, 0xffffff, 0xefefef)
			.field(0x000000, 0x202020, 0xdfdfdf);
		
		GRAY
			.border(0x000000, 0x202020)
			.base(0x808080, 0x000000, 0xffffff, 0xffffff)
			.field(0x404040, 0x808080, 0xffffff);
	
		BLUE
			.border(0x0000df, 0x300020)
			.base(0x2020a0, 0x000020, 0x8fffaf, 0x00cfaf)
			.field(0x505090, 0x406060, 0xcfdfff);
		
		CUSTOM
			.border(0x000000, 0x000000)
			.base(0x808080, 0x808080, 0xffffff, 0xffffff)
			.field(0x808080, 0x808080, 0xffffff);
	}

	private Style border(int top, int btm) {
		this.brdr_top = top | 0xff000000;
		this.brdr_btm = btm | 0xff000000;
		return this;
	}
	
	private Style base(int top, int btm, int text, int label) {
		this.fill_top = top | 0xff000000;
		this.fill_btm = btm | 0xff000000;
		this.text_base = text | 0xff000000;
		this.text_label = label | 0xff000000;
		return this;
	}
	
	private Style field(int top, int btm, int text) {
		this.field_top = top | 0xff000000;
		this.field_btm = btm | 0xff000000;
		this.text_field = text | 0xff000000;
		return this;
	}
	
	public String getName() {
		return this.id;
	}
	
	public String getDisplay() {
		return this.name;
	}
	
	public void copyToCustom() {
		CUSTOM
			.border(this.brdr_top, this.brdr_btm)
			.base(this.fill_top, this.fill_btm, this.text_base, this.text_label)
			.field(this.field_top, this.field_btm, this.text_field);
	}
}
