package es.verdnatura.domain

import android.content.Context
import com.google.gson.JsonObject
import es.verdnatura.presentation.view.feature.paletizador.model.*
import retrofit2.Call

class GetPaletizadoresUserCase(context: Context) : RestClient(context) {

    //buffer
    fun buffer_setTypeByName(
        usuario: String,
        password: String,
        vBufferFk: String,
        vType: String
    ): Call<Boolean> {
        val params: ArrayList<String> = ArrayList()
        params.add(vBufferFk)
        params.add(vType)
        return restClient!!.buffer_setTypeByName(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params = params
        )
    }

    //expeditionScan opciones paletizadores
    fun expedition_scan(usuario: String, password: String, vExpeditionId: String): Call<Void> {
        val params: ArrayList<String> = ArrayList()
        params.add(vExpeditionId)
        return restClient!!.expedition_scan(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    //informar cmr paletizadores
    fun cmrExpeditionPallet_add(
        usuario: String,
        password: String,
        vExpeditionPallet: String,
        vCmrId: String
    ): Call<Void> {
        val params: ArrayList<String> = ArrayList()
        params.add(vExpeditionPallet)
        params.add(vCmrId)

        return restClient!!.cmrExpeditionPallet_add(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }
    //expedition

    fun expedition_getState(
        usuario: String,
        password: String,
        expeditionFk: String
    ): Call<itemExpedetionState> {
        val params: ArrayList<String> = ArrayList()
        params.add(expeditionFk)
        return restClient!!.expedition_getState(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params = params
        )
    }

    fun expedition_getStateJSON(
        usuario: String,
        password: String,
        expeditionFk: String
    ): Call<JsonObject> {
        val params: ArrayList<String> = ArrayList()
        params.add(expeditionFk)
        return restClient!!.expedition_getStateJSON(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params = params
        )
    }

    fun expeditionTruckList(usuario: String, password: String): Call<List<ItemExpeditionTruckVO>> {
        // val params: ArrayList<String> = ArrayList()
        return restClient!!.expeditionTruckList("json", "1", usuario, password, "application/json")
    }

    fun expeditionTruckAdd(
        usuario: String,
        password: String,
        vHour: String,
        vDescription: String
    ): Call<Any> {
        val params: ArrayList<String> = ArrayList()
        params.add(vHour)
        params.add(vDescription)
        // //////Log.i("VERDNATURA:"," La hora es $vHour  y descrip $vDescription")
        return restClient!!.expeditionTruckAdd(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionPallet_List(
        usuario: String,
        password: String,
        vTruckFk: String
    ): Call<List<ItemPalletVO>> {
        val params: ArrayList<String> = ArrayList()
        params.add(vTruckFk)
        return restClient!!.expeditionPallet_List(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionScanAdd(
        usuario: String,
        password: String,
        vPalletFk: String,
        vTruckFk: String
    ): Call<List<ItemScanVO>> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        params.add(vTruckFk)
        return restClient!!.expeditionScanAdd(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionScanPut(
        usuario: String,
        password: String,
        vPalletFk: String,
        vExpeditionFk: String
    ): Call<Any> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        params.add(vExpeditionFk)
        return restClient!!.expeditionScanPut(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun checkRouteExpeditionScanPut(
        usuario: String,
        password: String,
        vPalletFk: String,
        vExpeditionFk: String
    ): Call<String> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        params.add(vExpeditionFk)
        return restClient!!.checkRouteExpeditionScanPut(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionPalletView(
        usuario: String,
        password: String,
        vPalletFk: String
    ): Call<List<ItemPalletViewVO>> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        return restClient!!.expeditionPalletView(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call<Any> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        return restClient!!.expeditionPalletDel(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionScanList(
        usuario: String,
        password: String,
        vPalletFk: String
    ): Call<List<ItemExpeditionScanVO>> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        return restClient!!.expeditionScanList(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call<Any> {
        val params: ArrayList<String> = ArrayList()
        params.add(vScanFk)
        return restClient!!.expeditionScanDel(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionPalletPrintSet(
        usuario: String,
        password: String,
        vPalletFk: String,
        vSectorFk: String
    ): Call<Any> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        params.add(vSectorFk)
        return restClient!!.expeditionPalletPrintSet(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionPallet_get(
        usuario: String,
        password: String,
        vPalletFk: String



    ): Call<ItemExpeditionTruckVO> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)

        return restClient!!.expeditionPallet_get(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }

    fun expeditionState_addByPallet(
        usuario: String,
        password: String,
        vPalletFk: String,
        vStateCode: String


    ): Call<Unit> {
        val params: ArrayList<String> = ArrayList()
        params.add(vPalletFk)
        params.add(vStateCode)

        return restClient!!.expeditionState_addByPallet(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }
    fun expeditionLoading_add(
        usuario: String,
        password: String,
        vExpeditionFk: String,
        vBufferFk: String
    ): Call<String> {
        val params: ArrayList<String> = ArrayList()
        params.add(vExpeditionFk)
        params.add(vBufferFk)
        return restClient!!.expeditionLoading_add(
            "json",
            "1",
            usuario,
            password,
            "application/json",
            params
        )
    }
}
