package com.joe.print.mvp.model;

import android.app.Application;

import com.gingersoft.gsa.cloud.bean.PublicBean;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.FragmentScope;

import javax.inject.Inject;

import com.joe.print.mvp.contract.LocalPrintContract;
import com.joe.print.mvp.model.server.PrintInfoService;

import io.reactivex.Observable;
import okhttp3.RequestBody;


@FragmentScope
public class LocalPrintModel extends BaseModel implements LocalPrintContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public LocalPrintModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<PublicBean> getPrinterCurrencyList(String restaurantId) {
        return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).getCurrencyPrenterList(restaurantId);
    }

    @Override
    public Observable<PublicBean> deletePrinterCurrency(RequestBody requestBody) {
        return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).updatePrinterCurrency(requestBody);
    }
}