// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Fn.java
// public abstract class Fn {
//     private Fn() {
//     }
// 
//     @JsFunction
//     public interface NoArg {
//         void e();
//     }
// 
//     @JsFunction
//     public interface Arg<A> {
//         void e(A arg);
//     }
// 
//     @JsFunction
//     public interface ArgRet<A, R> {
//         R e(A arg);
//     }
// 
//     @JsFunction
//     public interface Args {
//         void e(Object... args);
//     }
// 
//     @JsFunction
//     public interface Resolver<S, E> {
//         void e(Fn.Arg<S> resolve, Fn.Arg<E> reject);
//     }
// 
//     @JsFunction
//     public interface OpenResolver<S, E> {
//         void e(Fn.Arg<S> resolve, Fn.Arg<E> reject);
//     }
// }
// 
// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Promise.java
// @SuppressWarnings("ALL")
// @JsType(isNative = true, namespace = JsPackage.GLOBAL)
// public class Promise<S, E> extends Thenable<S, E> {
// 
//     @JsConstructor
//     public Promise(Fn.Resolver<S, E> resolver) {
//     }
// 
//     public static native <A, B> Promise<A, B> all(Promise<?, ?>[] promises);
// 
//     public static native <S> Promise<S, Error> resolve(S success);
// 
//     private Fn.Arg<S> resolve;
//     private Fn.Arg<E> reject;
// 
//     @JsOverlay
//     public final Promise<S, E> openResolve(S success) {
//         if (resolve == null) {
//             throw new UnsupportedOperationException("promise is not open, use buildOpenPromise");
//         }
//         resolve.e(success);
//         return this;
//     }
// 
//     @JsOverlay
//     public final Promise<S, E> openReject(E error) {
//         if (reject == null) {
//             throw new UnsupportedOperationException("promise is not open, use buildOpenPromise");
//         }
//         reject.e(error);
//         return this;
//     }
// 
//     @JsOverlay
//     public static <S, E> Promise<S, E> buildOpenPromise() {
//         final Map<String, Fn.Arg<?>> containers = new HashMap<>(2);
//         Fn.Resolver<S, E> resolver = new Fn.Resolver<S, E>() {
//             @Override
//             public void e(Fn.Arg<S> resolve, Fn.Arg<E> reject) {
//                 containers.put("resolve", resolve);
//                 containers.put("reject", reject);
//             }
//         };
//         Promise<S, E> openPromise = new Promise<S, E>(resolver);
//         openPromise.resolve = (Fn.Arg<S>) containers.get("resolve");
//         openPromise.reject = (Fn.Arg<E>) containers.get("reject");
//         return openPromise;
//     }
// }


import com.github.spirylics.xgwt.essential.Fn;
import com.github.spirylics.xgwt.essential.Promise;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
package com.github.spirylics.xgwt.firebase.auth;



@SuppressWarnings("ALL")
@JsType(isNative = true, namespace = "firebase.auth", name = "Auth")
public class Auth {

    public native Promise<Void, Error> applyActionCode(String code);

    public native Promise<ActionCodeInfo, Error> checkActionCode(String code);

    public native Promise<Void, Error> confirmPasswordReset(String code, String newPassword);

    public native Promise<UserCredential, Error> signInWithPopup(AuthProvider authProvider);

    public native Promise<User, Error> signInWithEmailAndPassword(String email, String password);

    public native Promise<User, Error> signInAnonymously();

    public native Promise<Void, Error> signOut();

    public native Promise<User, Error> createUserWithEmailAndPassword(String email, String password);

    public native Promise<String[], Error> fetchProvidersForEmail(String email);

    public native Promise<Void, Error> sendPasswordResetEmail(String email);

    public native Promise<User, Error> signInWithCredential(AuthCredential authCredential);

    public native Promise<User, Error> signInWithCustomToken(String token);

    public native Promise<Void, Error> signInWithRedirect(AuthProvider authProvider);

    public native Promise<String, Error> verifyPasswordResetCode(String code);


    @JsProperty
    public native User getCurrentUser();

    public native Fn.NoArg onAuthStateChanged(Fn.Arg<User> fn);

    @JsOverlay
    public final boolean isAuth() {
        return getCurrentUser() != null;
    }

    @JsOverlay
    public final AuthRegistration handleAuth(final Fn.Arg<User> fn) {
// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Fn.java
// public abstract class Fn {
//     private Fn() {
//     }
// 
//     @JsFunction
//     public interface NoArg {
//         void e();
//     }
// 
//     @JsFunction
//     public interface Arg<A> {
//         void e(A arg);
//     }
// 
//     @JsFunction
//     public interface ArgRet<A, R> {
//         R e(A arg);
//     }
// 
//     @JsFunction
//     public interface Args {
//         void e(Object... args);
//     }
// 
//     @JsFunction
//     public interface Resolver<S, E> {
//         void e(Fn.Arg<S> resolve, Fn.Arg<E> reject);
//     }
// 
//     @JsFunction
//     public interface OpenResolver<S, E> {
//         void e(Fn.Arg<S> resolve, Fn.Arg<E> reject);
//     }
// }
// 
// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Promise.java
// @SuppressWarnings("ALL")
// @JsType(isNative = true, namespace = JsPackage.GLOBAL)
// public class Promise<S, E> extends Thenable<S, E> {
// 
//     @JsConstructor
//     public Promise(Fn.Resolver<S, E> resolver) {
//     }
// 
//     public static native <A, B> Promise<A, B> all(Promise<?, ?>[] promises);
// 
//     public static native <S> Promise<S, Error> resolve(S success);
// 
//     private Fn.Arg<S> resolve;
//     private Fn.Arg<E> reject;
// 
//     @JsOverlay
//     public final Promise<S, E> openResolve(S success) {
//         if (resolve == null) {
//             throw new UnsupportedOperationException("promise is not open, use buildOpenPromise");
//         }
//         resolve.e(success);
//         return this;
//     }
// 
//     @JsOverlay
//     public final Promise<S, E> openReject(E error) {
//         if (reject == null) {
//             throw new UnsupportedOperationException("promise is not open, use buildOpenPromise");
//         }
//         reject.e(error);
//         return this;
//     }
// 
//     @JsOverlay
//     public static <S, E> Promise<S, E> buildOpenPromise() {
//         final Map<String, Fn.Arg<?>> containers = new HashMap<>(2);
//         Fn.Resolver<S, E> resolver = new Fn.Resolver<S, E>() {
//             @Override
//             public void e(Fn.Arg<S> resolve, Fn.Arg<E> reject) {
//                 containers.put("resolve", resolve);
//                 containers.put("reject", reject);
//             }
//         };
//         Promise<S, E> openPromise = new Promise<S, E>(resolver);
//         openPromise.resolve = (Fn.Arg<S>) containers.get("resolve");
//         openPromise.reject = (Fn.Arg<E>) containers.get("reject");
//         return openPromise;
//     }
// }


// Path: x-gwt-firebase/src/main/java/com/github/spirylics/xgwt/firebase/auth/Auth.java
import com.github.spirylics.xgwt.essential.Fn;
import com.github.spirylics.xgwt.essential.Promise;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

package com.github.spirylics.xgwt.firebase.auth;



@SuppressWarnings("ALL")
@JsType(isNative = true, namespace = "firebase.auth", name = "Auth")
public class Auth {

    public native Promise<Void, Error> applyActionCode(String code);

    public native Promise<ActionCodeInfo, Error> checkActionCode(String code);

    public native Promise<Void, Error> confirmPasswordReset(String code, String newPassword);

    public native Promise<UserCredential, Error> signInWithPopup(AuthProvider authProvider);

    public native Promise<User, Error> signInWithEmailAndPassword(String email, String password);

    public native Promise<User, Error> signInAnonymously();

    public native Promise<Void, Error> signOut();

    public native Promise<User, Error> createUserWithEmailAndPassword(String email, String password);

    public native Promise<String[], Error> fetchProvidersForEmail(String email);

    public native Promise<Void, Error> sendPasswordResetEmail(String email);

    public native Promise<User, Error> signInWithCredential(AuthCredential authCredential);

    public native Promise<User, Error> signInWithCustomToken(String token);

    public native Promise<Void, Error> signInWithRedirect(AuthProvider authProvider);

    public native Promise<String, Error> verifyPasswordResetCode(String code);


    @JsProperty
    public native User getCurrentUser();

    public native Fn.NoArg onAuthStateChanged(Fn.Arg<User> fn);

    @JsOverlay
    public final boolean isAuth() {
        return getCurrentUser() != null;
    }

    @JsOverlay
    public final AuthRegistration handleAuth(final Fn.Arg<User> fn) {
        return new AuthRegistration(this, fn);