package fr.plnech.dunbar.dummy

import android.provider.ContactsContract
import fr.plnech.dunbar.model.Friend
import java.util.*

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

    /**
     * An array of sample (dummy) items.
     */
    val ITEMS: MutableList<Friend> = ArrayList()

    /**
     * A map of sample (dummy) items, by ID.
     */
    val ITEM_MAP: MutableMap<Int, Friend> = HashMap()

    private val COUNT = 25

    init {
        // Add some sample items.
        for (i in 1..COUNT) {
            addItem(createFriend(i))
        }
    }

    private fun addItem(item: Friend) {
        ITEMS.add(item)
        ITEM_MAP[item.id] = item
    }

    private fun createFriend(position: Int): Friend {
        return Friend(
            mapOf(
                ContactsContract.Contacts._ID to "$position",
                ContactsContract.Contacts.DISPLAY_NAME to "Friend $position",
                "data1" to "01 23 45 67 89",
                "details" to "$position: this friend has a lot of details about them. What do you think?"
            )
        )
    }
}
