import * as i0 from '@angular/core';
import { Component, Input, NgModule } from '@angular/core';
import { ErrorType } from '@aztrix/models';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from '@aztrix/components/snackbar';
import { SnackbarModule } from '@aztrix/components/snackbar';
import * as i3 from '@angular/router';
import { RouterModule } from '@angular/router';
import * as i4 from '@aztrix/helpers';
import { HelperPipesModule } from '@aztrix/helpers';
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:
                return 'error.login.too-many-requests';
            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.default.title';
            case ErrorType.INVALID_TOKEN:
                return 'register.invalid.token';
            default:
                return 'error.default.title';
        }
    }
}
LoginErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LoginErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
LoginErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: LoginErrorsComponent, selector: "ax-login-errors", inputs: { errorType: "errorType", username: "username", profileType: "profileType", pendingLink: "pendingLink" }, 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\n<ax-snackbar\n  *ngIf=\"this.errorType !== ErrorType.NONE\"\n  [open]=\"this.errorType === ErrorType.LOGIN_NOT_VERIFIED\"\n  [dismissible]=\"false\"\n  color=\"red\"\n>\n  <span\n    >{{ 'error.login.not-verified' | translate }}\n    <a\n      [routerLink]=\"[pendingLink]\"\n      [queryParams]=\"{resend: true, profileType: profileType, username: username}\"\n      >{{ 'property.verification.modal.resend' | translate }}</a\n    ></span\n  >\n</ax-snackbar>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.SnackbarComponent, selector: "ax-snackbar", inputs: ["type", "timeout", "dismissible", "open", "icon", "color"], outputs: ["didClose"] }, { kind: "directive", type: i3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", 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\n<ax-snackbar\n  *ngIf=\"this.errorType !== ErrorType.NONE\"\n  [open]=\"this.errorType === ErrorType.LOGIN_NOT_VERIFIED\"\n  [dismissible]=\"false\"\n  color=\"red\"\n>\n  <span\n    >{{ 'error.login.not-verified' | translate }}\n    <a\n      [routerLink]=\"[pendingLink]\"\n      [queryParams]=\"{resend: true, profileType: profileType, username: username}\"\n      >{{ 'property.verification.modal.resend' | translate }}</a\n    ></span\n  >\n</ax-snackbar>\n" }]
        }], propDecorators: { errorType: [{
                type: Input
            }], username: [{
                type: Input
            }], profileType: [{
                type: Input
            }], pendingLink: [{
                type: Input
            }] } });

class LoginErrorsModule {
}
LoginErrorsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LoginErrorsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
LoginErrorsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: LoginErrorsModule, declarations: [LoginErrorsComponent], imports: [CommonModule, SnackbarModule, HelperPipesModule, ButtonModule, RouterModule], exports: [LoginErrorsComponent] });
LoginErrorsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LoginErrorsModule, imports: [CommonModule, SnackbarModule, HelperPipesModule, ButtonModule, RouterModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", 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
//# sourceMappingURL=aztrix-components-login-errors.mjs.map
