package com.gh.gamecenter.mock

import com.gh.gamecenter.common.HaloApp
import com.gh.gamecenter.mock.mockinizer.RequestFilter
import com.gh.gamecenter.mock.mockwebserver3.MockResponse


private fun getJsonByAssets(fileName: String): String{
    return HaloApp.getInstance().resources.assets.open("assistant-android-mock/apiMock/${fileName}").bufferedReader().use {
        it.readText()
    }
}

val mocks: Map<RequestFilter, MockResponse> = mapOf(

//    RequestFilter("/v5d5d0/home/union") to MockResponse().apply {
//        setResponseCode(200)
//        setBody(
//            getJsonByAssets("home_union.json")
//        )
//    },
//    RequestFilter("/v5d5d0/blocks/5de21b5d75e6fa054f784882/columns") to MockResponse().apply {
//        setResponseCode(200)
//        setBody(
//            getJsonByAssets("game_block_columns.json")
//        )
//    },
    RequestFilter("/settings") to MockResponse().apply {
        setResponseCode(200)
        setBody(
            getJsonByAssets("new_settings.json")
        )
    },

    RequestFilter("/v5d5d0/games/5e13dca215452600e6236a45") to MockResponse().apply {
        setResponseCode(200)
        setBody(
            getJsonByAssets("game_detail.json")
        )
    }

)