package com.example.tampopo_client.views.placeholder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Helper class for providing sample content for user interfaces created by
 * Android template wizards.
 * <p>
 * TODO: Replace all uses of this class before publishing your app.
 */
public class FriendContent {

    /**
     * An array of sample (placeholder) items.
     */

    public static final List<FriendItem> ITEMS = new ArrayList<FriendItem>();

    /**
     * A map of sample (placeholder) items, by ID.
     */
    public static final Map<String, FriendItem> ITEM_MAP = new HashMap<String, FriendItem>();

    private static final int COUNT = 30;

    //static {
    //    // Add some sample items.
    //    for (int i = 1; i <= COUNT; i++) {
    //        addItem(createPlaceholderItem(i));
    //    }
    //}


    public static void addItem(FriendItem item) {

        ITEMS.add(item);
        ITEM_MAP.put(item.id, item);
    }

    public static void clear() {
        ITEMS.clear();
        ITEM_MAP.clear();
    }


    //private static FriendItem createPlaceholderItem(int position) {
    //    return new FriendItem(String.valueOf(position), "ユーザー名 " , makeDetails(position));

    //}

    private static String makeDetails(int position) {
        StringBuilder builder = new StringBuilder();
        builder.append("Details about Item: ").append(position);
        for (int i = 0; i < position; i++) {
            builder.append("\nMore details information here.");
        }
        return builder.toString();
    }

    /**
     * A placeholder item representing a piece of content.
     */

    public static class FriendItem {

        public final String id;
        public final String name;



        public FriendItem(String id, String name) {

            this.id = id;
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }
}