package v1_menu;


public class Container {
    String name; //name of the container
    State state; //state of the container
    Temperature temperature; //temperature of the container
    Portion portion; //portion of the container    

    public Container(String name, State state, Temperature temperature, Portion portion) {
        this.name = name;
        this.state = state;
        this.temperature = temperature;
        this.portion = portion;
    }
    
    @Override
    public String toString() {
        return this.name + "with portion = " + this.portion.toString();
    }
    public static Container create(Portion portion) {
        Temperature temperature = portion.getTemperatura();
        State state = portion.getState();
        if (temperature == Temperature.COLD) {
            if (state == State.LIQUID) {
                return new Container("PlasticBottle", state, temperature, portion);
            } else if (state == State.SOLID) {
                return new Container("PlasticBag", state, temperature, portion);
            }
        }
        else if (temperature == Temperature.WARM) {
            if (state == State.LIQUID) {
                return new Container("TermicBottle", state, temperature, portion);

            } else if (state == State.SOLID) {
                return new Container("Tupperware", state, temperature, portion);

            }
        }
        return null;
    }
}
