import * as contracts from "@codiac.io/codiac-common/contracts";
import { AuthTenant, TenantUser } from "@codiac.io/codiac-common/security";
import { TokenHolder } from "./token-holder";
export interface IAuthClient {
    /** Logs in remotely with the given credentials.
     * Returns a valid token in the headers of the response
     * and the user info in the body of the response.
     * @param login The human readable unique identifier for the user.
     * @param password the secret held for this particular user.
     * @param tenantCode (optional) Unique identifier of the tenant to activate with this authentication.
     */
    authenticate(login: string, password: string, tenantCode?: string): Promise<contracts.SingleResult<TokenHolder>>;
    /** Provides the ability to extend an existing token.
     *  Returns failure for invalid or revoked tokens.
     *  Returns any errors encountered refreshing.
     * @param currentToken The JWT token returned in a prior request.
     * */
    refreshToken(currentToken: string): Promise<contracts.SingleResult<TokenHolder>>;
    /** Retrieves the full account info for the current user (minus any passwords),
     *  including all tenant profiles.
     *  Returns failure for invalid or revoked tokens.
     *  Returns any errors encountered refreshing.
     *  NOTE: keeps the returned auth token in scope for this client instance.
     * @param currentToken The JWT token returned in a prior request.   */
    whoAmI(currentToken: string): Promise<contracts.SingleResult<TenantUser>>;
    /** Provides the ability to extend an existing token.
     *  Returns failure for invalid or revoked tokens.
     * @param currentToken The JWT token returned in a prior request.
     * @param tenantCode Unique identifier of the tenant being switched to.
     *  Returns any errors encountered refreshing.  */
    switchTenant(currentToken: string, tenantCode: string): Promise<contracts.SingleResult<TokenHolder>>;
    /** Declares a new organization in the toyhauler system.
     * The given user account is made the administrator for that organization,
     * and if the new user flag is given,
     * the user account will get created.
     * @param tenantName Human readable friendly title for the tenant.  NOT used for system identification.
     * @param newUser Flag to create a new user account with the given credentials.
     * @param userName User to be the adminstrator for the new tenant.
     * @param password Password for the given user (desired password if the newuser flag is set).
     * @param tenantCode (optional) Desired unique identifier for the new tenant (if omitted one will be generated).
     * @param currentToken The JWT token returned in a prior request.
     *  */
    registerTenant(tenantName: string, newUser: boolean, userName: string, password: string, tenantCode?: string, currentToken?: string): Promise<contracts.SingleResult<AuthTenant>>;
}
