package cpsc4620;

public class Topping {

	private int TopID;
	private String TopName;
	private double PerAMT;
	private double MedAMT;
	private double LgAMT;
	private double XLAMT;
	private double CustPrice;
	private double BusPrice;
	private double MinINVT;
	private double CurINVT;
	
	public Topping(int topID, String topName, double perAMT, double medAMT, double lgAMT, double xLAMT,
			double custPrice, double busPrice, double minINVT, double curINVT) {

		TopID = topID;
		TopName = topName;
		PerAMT = perAMT;
		MedAMT = medAMT;
		LgAMT = lgAMT;
		XLAMT = xLAMT;
		CustPrice = custPrice;
		BusPrice = busPrice;
		MinINVT = minINVT;
		CurINVT = curINVT;

	}

	public int getTopID() {
		return TopID;
	}

	public String getTopName() {
		return TopName;
	}

	public double getPerAMT() {
		return PerAMT;
	}

	public double getMedAMT() {
		return MedAMT;
	}

	public double getLgAMT() {
		return LgAMT;
	}

	public double getXLAMT() {
		return XLAMT;
	}

	/**
	 * Wrapper function which returns the correct topping amount based on the pizza size string.
	 *
	 * @param size Pizza size
	 * @return Amount of topping
	 */
	public double getVarAMT(String size, boolean isDoubled) {

		double amount;

		if (size == DBNinja.size_s) {

			amount = getPerAMT();

		} else if (size == DBNinja.size_m) {

			amount = getMedAMT();

		} else if (size == DBNinja.size_l) {

			amount = getLgAMT();

		} else {

			amount = getXLAMT();

		}

		if (isDoubled) {

			amount = amount * 2;

		}

		return amount;

	}

	public double getCustPrice() {
		return CustPrice;
	}

	public double getBusPrice() {
		return BusPrice;
	}

	public double getMinINVT() {
		return MinINVT;
	}

	public double getCurINVT() {
		return CurINVT;
	}

	public void setTopID(int topID) {
		TopID = topID;
	}

	public void setTopName(String topName) {
		TopName = topName;
	}

	public void setPerAMT(double perAMT) {
		PerAMT = perAMT;
	}

	public void setMedAMT(double medAMT) {
		MedAMT = medAMT;
	}

	public void setLgAMT(double lgAMT) {
		LgAMT = lgAMT;
	}

	public void setXLAMT(double xLAMT) {
		XLAMT = xLAMT;
	}

	public void setCustPrice(double custPrice) {
		CustPrice = custPrice;
	}

	public void setBusPrice(double busPrice) {
		BusPrice = busPrice;
	}

	public void setMinINVT(int minINVT) {
		MinINVT = minINVT;
	}

	public void setCurINVT(double curINVT) {
		CurINVT = curINVT;
	}

	@Override
	public String toString() {

		return "Topping [TopID=" + TopID + ", TopName=" + TopName + ", PerAMT=" + PerAMT + ", MedAMT=" + MedAMT
				+ ", LgAMT=" + LgAMT + ", XLAMT=" + XLAMT + ", CustPrice=" + CustPrice + ", BusPrice=" + BusPrice
				+ ", MinINVT=" + MinINVT + ", CurINVT=" + CurINVT + "]";

	}

	/**
	 * Overridden equals() method for Topping to allow comparison of Topping objects.
	 *
	 * @param o Topping object to compare against
	 * @return Whether the Topping objects are equal
	 */
	@Override
	public boolean equals(Object o) {

		if (!(o instanceof Topping)) {

			return false;

		}

		return this.getTopID() == ((Topping) o).getTopID();

	}

}