package fr.masciulli.drinks.data;


import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import fr.masciulli.drinks.model.DrinksListItem;

public class DrinksListProvider {
    public static List<DrinksListItem> getDrinks() throws IOException {
        List<DrinksListItem> drinks;

        String json = "[]";

        ObjectMapper mapper = new ObjectMapper();
        drinks = mapper.readValue(json, new TypeReference<ArrayList<DrinksListItem>>() { });

//        DrinksListItem amarettoFrost = new DrinksListItem();
//        amarettoFrost.setId("amarettofrost");
//        amarettoFrost.setName("Amaretto Frost");
//        amarettoFrost.setImageURL("http://www.smallscreennetwork.com/videos/cocktail_spirit/morgenthaler-method-amaretto-sour.jpg");
//
//        DrinksListItem americano = new DrinksListItem();
//        americano.setId("americano");
//        americano.setName("Americano");
//        americano.setImageURL("http://www.ganzomag.com/wp-content/uploads/2012/05/americano-cocktail1.jpg");
//
//        DrinksListItem tomCollins = new DrinksListItem();
//        tomCollins.setId("tomcollins");
//        tomCollins.setName("Tom Collins");
//        tomCollins.setImageURL("http://www.vinumimporting.com/wp-content/uploads/2012/06/tom-collins.jpg");
//
//        DrinksListItem mojito = new DrinksListItem();
//        mojito.setId("mojito");
//        mojito.setName("Mojito");
//        mojito.setImageURL("http://2eat2drink.files.wordpress.com/2011/04/mojito-final2.jpg");
//
//        DrinksListItem dryMartini = new DrinksListItem();
//        dryMartini.setId("drymartini");
//        dryMartini.setName("Dry Martini");
//        dryMartini.setImageURL("http://www.cocktailrendezvous.com/images.php?f=files/recipes/images/martini.jpg&w=616&h=347&c=1");
//
//        DrinksListItem blueLagoon = new DrinksListItem();
//        blueLagoon.setId("bluelagoon");
//        blueLagoon.setName("Blue Lagoon");
//        blueLagoon.setImageURL("http://www.youman.dp.ua/images/stories/Nastmygchina/gurman/cocktails/laguna/Blue_Lagoon_Cocktail_Photo.gif");

//        drinks.add(amarettoFrost);
//        drinks.add(americano);
//        drinks.add(tomCollins);
//        drinks.add(mojito);
//        drinks.add(dryMartini);
//        drinks.add(blueLagoon);

        return drinks;
    }
}

@@ -434,16 +434,1020 @@
 son = %22%5B
+%7B%5C%22name%5C%22:%5C%22Amaretto Frost%5C%22,%5C%22id%5C%22:%5C%22amarettofrost%5C%22,%5C%22imageURL%5C%22:%5C%22http://www.smallscreennetwork.com/videos/cocktail_spirit/morgenthaler-method-amaretto-sour.jpg%5C%22%7D,%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22Americano%5C%22,%5C%22id%5C%22:%5C%22americano%5C%22,%5C%22imageURL%5C%22:%5C%22http://www.ganzomag.com/wp-content/uploads/2012/05/americano-cocktail1.jpg%5C%22%7D,%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22Tom Collins%5C%22,%5C%22id%5C%22:%5C%22tomcollins%5C%22,%5C%22imageURL%5C%22:%5C%22http://www.vinumimporting.com/wp-content/uploads/2012/06/tom-collins.jpg%5C%22%7D,%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22Mojito%5C%22,%5C%22id%5C%22:%5C%22mojito%5C%22,%5C%22imageURL%5C%22:%5C%22http://2eat2drink.files.wordpress.com/2011/04/mojito-final2.jpg%5C%22%7D,%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22Dry Martini%5C%22,%5C%22id%5C%22:%5C%22drymartini%5C%22,%5C%22imageURL%5C%22:%5C%22http://www.cocktailrendezvous.com/images.php?f=files/recipes/images/martini.jpg&w=616&h=347&c=1%5C%22%7D,%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22Blue Lagoon%5C%22,%5C%22id%5C%22:%5C%22bluelagoon%5C%22,%5C%22imageURL%5C%22:%5C%22http://www.youman.dp.ua/images/stories/Nastmygchina/gurman/cocktails/laguna/Blue_Lagoon_Cocktail_Photo.gif%5C%22%7D
 %5D%22;%0A%0A   

Use sample json to fill drinks list