import { IApiSuccess } from '../../api.models';
import { IUser } from '../../common.models';
import { IGroup } from '../Groups/Groups.models';
import { CredentialType } from '../../../../../_core/types/Login';

export interface IUserProfile {
    login: string;
    vorname: string;
    name: string;
    adresse?: string;
    ort?: string;
    plz?: string;
    land?: string;
    email: string;
    comment?: string;
    pass?: string;
    active?: number;
    generatePasswortType?: number;
    authtypeU2F?: boolean;
    roleInTenant?: string;
    id: number;
    groups?: {
        groupId: number;
        validFrom?: string;
        validTo?: string;
    }[];
}
export interface IUserProfileResponse extends IApiSuccess {
    uid: number;
}
export interface ISaveNewPasswordOptions {
    oldpass?: string;
    newpass: string;
    newpass_repeat: string;
}
export interface IUserToGroup {
    user: IUser;
    group: IGroup;
    validFrom: string;
    validTo: string;
    companyRole: string;
    id: number;
}
export interface ISshKey {
    uid: number;
    pubkey: string;
    id: number;
}
export interface IU2FKey {
    certificate: string;
    counter: number;
    created: string;
    createdBy: number;
    createdByUsername: string;
    isWebAuthn: boolean;
    keyHandle: string;
    modified: string;
    modifiedBy: number;
    modifiedByUsername: string;
    publicKey: string;
    uid: number;
    id: number;
}
export interface IRequestRegisterWebAuthn extends IApiSuccess {
    token: string;
    url: string;
    data: {
        publicKey: {
            rp: {
                name: string;
                id: string;
            };
            authenticatorSelection: {
                userVerification: string;
                authenticatorAttachment: string;
            };
            user: {
                id: string;
                name: string;
                displayName: string;
            };
            pubKeyCredParams: {
                type: string;
                alg: number;
            }[];
            attestation: string;
            extensions: {
                exts: boolean;
            };
            timeout: number;
            challenge: string;
            excludeCredentials: [];
        };
    };
}
export declare enum AUTH_TYPE {
    U2F_READY = "u2fFrameReady",
    U2F_REGISTER_RESULT = "u2fRegisterResult2",
    U2F_REGISTER_REQUEST_2 = "u2fRegisterRequest2",
    U2F_SIGN_REQUEST_2 = "u2fSignRequest2",
    U2F_SIGN_RESULT = "u2fSignResult2",
    OAUTH2_READY = "oauth2Ready"
}
export interface IU2fReadyData {
    type: AUTH_TYPE.U2F_READY;
}
export interface IAuthData {
    type: AUTH_TYPE.U2F_REGISTER_RESULT | AUTH_TYPE.U2F_SIGN_RESULT | AUTH_TYPE.OAUTH2_READY;
    data: Record<string, string>;
    token: string;
}
export type IU2fEventMessage = MessageEvent<IU2fReadyData | IAuthData>;
interface IPasswordCredential {
    type: CredentialType.Password | CredentialType.UserName;
}
interface IPopupAuth {
    url: string;
    target: string;
    data?: {
        type: AUTH_TYPE;
        data: any;
    };
}
export interface IAuthCredential {
    type: CredentialType.WebAuthn | CredentialType.OAuth2;
    data: IPopupAuth;
    storeAuth: (data: IAuthData) => void;
}
export type ICredential = IPasswordCredential | IAuthCredential;
export {};
