package tw.com.altob.goodpk.Loader;

import android.content.Context;

import androidx.annotation.NonNull;

import com.ga.sdk.loader.BaseAsyncTaskLoader;

import tw.com.altob.goodpk.Api.GoodPkApi;
import tw.com.altob.goodpk.Bean.CS;
import tw.com.altob.goodpk.Parser.CarSecurityParser;

public class ChengePWLoader  extends BaseAsyncTaskLoader<CS> {

    private String Acct, Pwd, NPwd, Key;
    private Context mContext;

    public ChengePWLoader(@NonNull Context context, String mAcct, String mPwd, String mNPwd, String mkey) {
        super(context);

        this.mContext = context;
        this.Acct = mAcct;
        this.Pwd = mPwd;
        this.NPwd = mNPwd;
        this.Key = mkey;
    }

    @Override
    protected String action() throws Exception {
        GoodPkApi api = new GoodPkApi().withAccessToken(this.mContext);
        return api.changePwd(this.Acct, this.Pwd, this.NPwd, this.Key);
    }

    @Override
    protected CS parseData(String s) throws Exception {
        CarSecurityParser parser = new CarSecurityParser();

        return parser.toData(s);
    }
}
