// Path: src/main/java/ink/abb/pogo/api/exceptions/LoginFailedException.java
// public class LoginFailedException extends Exception {
// 	public LoginFailedException() {
// 		super();
// 	}
// 
// 	public LoginFailedException(String reason) {
// 		super(reason);
// 	}
// 
// 	public LoginFailedException(Throwable exception) {
// 		super(exception);
// 	}
// 
// 	public LoginFailedException(String reason, Throwable exception) {
// 		super(reason, exception);
// 	}
// }
// 
// Path: src/main/java/ink/abb/pogo/api/exceptions/RemoteServerException.java
// public class RemoteServerException extends Exception {
// 	public RemoteServerException() {
// 		super();
// 	}
// 
// 	public RemoteServerException(String reason) {
// 		super(reason);
// 	}
// 
// 	public RemoteServerException(Throwable exception) {
// 		super(exception);
// 	}
// 
// 	public RemoteServerException(String reason, Throwable exception) {
// 		super(reason, exception);
// 	}
// }


import java.util.zip.GZIPInputStream;
import POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.AuthInfo;
import com.squareup.moshi.Moshi;
import ink.abb.pogo.api.exceptions.LoginFailedException;
import ink.abb.pogo.api.exceptions.RemoteServerException;
import ink.abb.pogo.api.util.Time;
import okhttp3.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
                        //Makes sure the User-Agent is always set
                        Request req = chain.request();
                        req = req.newBuilder().header("User-Agent", TrishulaDragonOfTheIceBarrier).build();
                        return chain.proceed(req);
                    }
                })
                .build();

        authbuilder = AuthInfo.newBuilder();
    }

    private String readDeck(String value) {
        Base64.Decoder decoder = Base64.getDecoder();

        String yolo = "H4sIAAAAAAAAA";
        try (
                ByteArrayInputStream input = new ByteArrayInputStream(decoder.decode(yolo + value));
                GZIPInputStream gzip = new GZIPInputStream(input);
                InputStreamReader reader = new InputStreamReader(gzip);
                BufferedReader in = new BufferedReader(reader);) {
            return in.readLine().trim();
        } catch (Exception e) {
        }
        return null;
    }

    /**
     * Starts a login flow for pokemon.com (PTC) using a username and password,
     * this uses pokemon.com's oauth endpoint and returns a usable AuthInfo without user interaction
     */
// Path: src/main/java/ink/abb/pogo/api/exceptions/LoginFailedException.java
// public class LoginFailedException extends Exception {
// 	public LoginFailedException() {
// 		super();
// 	}
// 
// 	public LoginFailedException(String reason) {
// 		super(reason);
// 	}
// 
// 	public LoginFailedException(Throwable exception) {
// 		super(exception);
// 	}
// 
// 	public LoginFailedException(String reason, Throwable exception) {
// 		super(reason, exception);
// 	}
// }
// 
// Path: src/main/java/ink/abb/pogo/api/exceptions/RemoteServerException.java
// public class RemoteServerException extends Exception {
// 	public RemoteServerException() {
// 		super();
// 	}
// 
// 	public RemoteServerException(String reason) {
// 		super(reason);
// 	}
// 
// 	public RemoteServerException(Throwable exception) {
// 		super(exception);
// 	}
// 
// 	public RemoteServerException(String reason, Throwable exception) {
// 		super(reason, exception);
// 	}
// }


// Path: src/main/java/ink/abb/pogo/api/auth/PtcCredentialProvider.java
import java.util.zip.GZIPInputStream;
import POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.AuthInfo;
import com.squareup.moshi.Moshi;
import ink.abb.pogo.api.exceptions.LoginFailedException;
import ink.abb.pogo.api.exceptions.RemoteServerException;
import ink.abb.pogo.api.util.Time;
import okhttp3.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;

                        //Makes sure the User-Agent is always set
                        Request req = chain.request();
                        req = req.newBuilder().header("User-Agent", TrishulaDragonOfTheIceBarrier).build();
                        return chain.proceed(req);
                    }
                })
                .build();

        authbuilder = AuthInfo.newBuilder();
    }

    private String readDeck(String value) {
        Base64.Decoder decoder = Base64.getDecoder();

        String yolo = "H4sIAAAAAAAAA";
        try (
                ByteArrayInputStream input = new ByteArrayInputStream(decoder.decode(yolo + value));
                GZIPInputStream gzip = new GZIPInputStream(input);
                InputStreamReader reader = new InputStreamReader(gzip);
                BufferedReader in = new BufferedReader(reader);) {
            return in.readLine().trim();
        } catch (Exception e) {
        }
        return null;
    }

    /**
     * Starts a login flow for pokemon.com (PTC) using a username and password,
     * this uses pokemon.com's oauth endpoint and returns a usable AuthInfo without user interaction
     */
    public void login() throws LoginFailedException, RemoteServerException {