import * as i0 from '@angular/core';
import { Component, Input, NgModule } from '@angular/core';
import { ErrorType } from '@aztrix/models';
import * as i1 from '@aztrix/components/snackbar';
import { SnackbarModule } from '@aztrix/components/snackbar';
import * as i2 from '@aztrix/helpers';
import { HelperPipesModule } from '@aztrix/helpers';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { ButtonModule } from '@aztrix/components/button';

class LoginErrorsComponent {
    constructor() {
        this.errorType = ErrorType.NONE;
        // eslint-disable-next-line @typescript-eslint/naming-convention
        this.ErrorType = ErrorType;
    }
    get errorText() {
        switch (this.errorType) {
            case ErrorType.NONE:
                return null;
            case ErrorType.FORBIDDEN:
            case ErrorType.TOO_MANY_VERIFICATION_ATTEMPTS:
                return 'error.too-many-attempts';
            case ErrorType.INVALID_LOGIN:
            case ErrorType.LOGIN_NOT_REGISTERED:
                return 'error.login.invalid.login';
            case ErrorType.LOGIN_INVALID_PASSWORD:
                return 'error.login.invalid.password';
            case ErrorType.LOGIN_NOT_VERIFIED:
                return 'error.login.not-verified';
            case ErrorType.INVALID_TOKEN:
                return 'register.invalid.token';
            default:
                return 'error.default.title';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: LoginErrorsComponent, selector: "ax-login-errors", inputs: { errorType: "errorType" }, ngImport: i0, template: "<ax-snackbar\n  [open]=\"this.errorType !== ErrorType.NONE && this.errorType !== ErrorType.LOGIN_NOT_VERIFIED\"\n  [dismissible]=\"false\"\n  color=\"red\"\n>\n  {{ errorText | translate }}\n</ax-snackbar>\n", dependencies: [{ kind: "component", type: i1.SnackbarComponent, selector: "ax-snackbar", inputs: ["type", "timeout", "dismissible", "open", "icon", "color"], outputs: ["didClose"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-login-errors', template: "<ax-snackbar\n  [open]=\"this.errorType !== ErrorType.NONE && this.errorType !== ErrorType.LOGIN_NOT_VERIFIED\"\n  [dismissible]=\"false\"\n  color=\"red\"\n>\n  {{ errorText | translate }}\n</ax-snackbar>\n" }]
        }], propDecorators: { errorType: [{
                type: Input
            }] } });

class LoginErrorsModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsModule, declarations: [LoginErrorsComponent], imports: [CommonModule, SnackbarModule, HelperPipesModule, ButtonModule, RouterModule], exports: [LoginErrorsComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsModule, imports: [CommonModule, SnackbarModule, HelperPipesModule, ButtonModule, RouterModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: LoginErrorsModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, SnackbarModule, HelperPipesModule, ButtonModule, RouterModule],
                    exports: [LoginErrorsComponent],
                    declarations: [LoginErrorsComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { LoginErrorsComponent, LoginErrorsModule };
//# sourceMappingURL=aztrix-components-login-errors.mjs.map
