package com.ramos.munoz.tesis;

import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
import android.accounts.NetworkErrorException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class AutenticadorLogin extends AbstractAccountAuthenticator {

    private Context contexto;

    public AutenticadorLogin(Context context) {
	super(context);
	contexto = context;
    }

    @Override
    public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options)
	    throws NetworkErrorException {
	final Bundle result;
	final Intent intent;
	Log.d("AUT", authTokenType + "| TOKEN");

	intent = new Intent(contexto, LoginActivity.class);
	intent.putExtra(LoginActivity.PARAM_AUTHOKEN_TYPE, authTokenType);
	intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);

	result = new Bundle();
	result.putParcelable(AccountManager.KEY_INTENT, intent);

	return result;
    }

    @Override
    public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) {
	return null;
    }

    @Override
    public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
	return null;
    }

    @Override
    public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
	return null;
    }

    @Override
    public String getAuthTokenLabel(String authTokenType) {
	return null;
    }

    @Override
    public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException {
	return null;
    }

    @Override
    public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) {
	return null;
    }

}
