package com.hc.viewmodel;

import android.app.Application;
import android.support.annotation.NonNull;
import android.widget.Toast;

import com.hc.model.FJYD.AuthResponseUrl;
import com.hc.request.business.FJYDService;
@Deprecated
public class FJYDViewModel extends BaseViewModel {

    private FJYDService service;
    public SingleLiveEvent<AuthResponseUrl> videoUrl = new SingleLiveEvent<>();

    FJYDViewModel(@NonNull Application application) {
        super(application);
        service = new FJYDService(application.getApplicationContext());
    }

    public void auth(String cid) {
        service.auth(cid, new ViewModelHttpCallback<AuthResponseUrl>(this) {
            @Override
            public void onSuccess(int what, @NonNull AuthResponseUrl data) {
                super.onSuccess(what, data);
                videoUrl.setValue(data);
            }

            @Override
            public void onFail(int what, String msg) {
                super.onFail(what, msg);
                Toast.makeText(getApplication().getApplicationContext(), msg, Toast.LENGTH_LONG).show();
            }
        });
    }
}
