package com.wd.workoffice.model;

import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.contract.WorkProContract;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.util.WorkUtils;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;

/**
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class WorkProModel implements WorkProContract.Model {
    @Override
    public Observable<BaseBean> getPro(Map<String, Object> param) {
        return RtfUtils.getRtf().getPro(param);
    }

    @Override
    public Observable<BaseBean> modify(Integer id, String internalPrice, String remark) {
        Map<String,Object> param =new HashMap<>();
        param.put("id",id);
        param.put("internalPrice",internalPrice);
        param.put("remark",remark);
        return RtfUtils.getRtf().modifyProPrice( WorkUtils.convertMapToBody(param));
    }

    @Override
    public Observable<BaseBean> onSale(Integer id, String shelfAction) {
        Map<String,Object> param =new HashMap<>();
        param.put("id",id);
        param.put("shelfAction",shelfAction);
        return RtfUtils.getRtf().onSalePro(param);
    }

    public static WorkProModel newInstance() {
        return new WorkProModel();
    }
}
