//
// https://www.ramecera.it/myscrewdriver.html
// e-mail: screwdriver@ramecera.it
//
/* This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License v1.0 which accompanies this
 * distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html */
package it.ramecera.screwdriver.component;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

import it.ramecera.salad.everyday.Candies;
import it.ramecera.salad.everyday.ExactException;
import it.ramecera.salad.file.Equipment;
import it.ramecera.screwdriver.CandyScrew;
import it.ramecera.screwdriver.Markup;
import it.ramecera.screwdriver.Skill;
import it.ramecera.screwdriver.Train;
import it.ramecera.screwdriver.outfits.Costume;

/** @author M. Maglioni */
final public class Screwdriver_cssC extends FileComponent {

	/** @param skill together with the descriptive data of the
	 * @param snippetG application */
	public Screwdriver_cssC(Skill skill, String snippetG) {
		super();
		this.skill = skill;
		this.snippetG = snippetG;
	}

	/** @throws ExactException exception specified by a numeric code */
	@Override
	public void synthesis(HashMap<String, Markup> markupE,
			List<Train> trainE, CandyScrew candyScrew)

			throws FileNotFoundException, IOException, ExactException {

		String g = skill.candies.snippetsYS + snippetG;
		producedMaterial = Equipment.oneString(g) + Candies.LF;

		for (Costume c : skill.costumeE) {
			producedMaterial += "." + c.className + "C {" + Candies.LF;
			producedMaterial += Candies.TABS + "color: " + c.color + ";"
					+ Candies.LF;
			producedMaterial += Candies.TABS + "background-color: "
					+ c.background_color + ";" + Candies.LF;
			producedMaterial += Candies.TABS + "border-color: "
					+ c.background_color + ";" + Candies.LF;
			producedMaterial += Candies.TABS + "padding-top: "
					+ c.padding_top + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "padding-left: "
					+ c.padding_left + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "padding-right: "
					+ c.padding_right + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "padding-bottom: "
					+ c.padding_bottom + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "font-size: " + Integer
					.valueOf(c.font_size) * 1.5 + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "margin-top: "
					+ c.margin_top + "px;" + Candies.LF;
			producedMaterial += Candies.TABS + "text-align: center;"
					+ Candies.LF;
			producedMaterial += "}" + Candies.LF;
		}

	}

	/* written only to comply with the abstract class FileComponent */
	@SuppressWarnings("javadoc")
	@Override
	/** @param markupE the list of markups
	 * @param skill together with the characteristics of the application
	 * @param trash file where the deleted files are moved
	 * @throws ExactException exception specified by a numeric code */
	public void directory(HashMap<String, Markup> markupE)

			throws ExactException {

	}
}
