/**
 * 
 */
package com.orsomethinglikethat.example;

/**
 * @author lpillow
 */
public enum MenuItem
{
    CHEESEBURGER( "McCheesy", new Double( 0.99 ) ), //
    FRIES( "McFrench Frie", new Double( 0.75 ) ), //
    DRINK( "McSoft Drink", new Double( 1.29 ) ), //
    
    /**
     * Menu Item consisting of 2 cheeseburgers, 1 frie, & 1 drink.
     */
    DOUBLE_CHEESE_MEAL( "Double McCheesy Meal Deal" )
    {
        /**
         * Calculate the price based on the contents of the the meal.
         * @return
         */
        @Override
        public Double getPrice()
        {
            return ( CHEESEBURGER.getPrice() * 2 ) + FRIES.getPrice() + DRINK.getPrice();
        }
    };

    private String displayName;
    private Double price;

    /**
     * Construct a MenuItem given only a displayName
     * @param displayName
     */
    private MenuItem( String displayName )
    {
        this.displayName = displayName;
        this.price = new Double( 0 );
    }

    /**
     * Construct a MenuItem given a displayName and price
     * @param displayName
     * @param price
     */
    private MenuItem( String displayName, Double price )
    {
        this( displayName );
        this.price = price;
    }
    
    /**
     * Given a sales tax rate, calculate the sales price of this menu item including sales tax
     * @param salesTaxRate
     * @return Sales Tax Double
     */
    public Double calculateSalePrice( Double salesTaxRate )
    {
        return this.getPrice() + ( this.getPrice() * salesTaxRate );
    }

    /**
     * @return the displayName
     */
    public String getDisplayName()
    {
        return displayName;
    }

    /**
     * @return the price
     */
    public Double getPrice()
    {
        return price;
    }
    
    @Override
    public String toString()
    {
        return this.getDisplayName();
    }

}
