import { Component, Input } from '@angular/core';
import { ErrorType } from '@aztrix/models';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@aztrix/components/snackbar";
import * as i3 from "@angular/router";
import * as i4 from "@aztrix/helpers";
export 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
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9naW4tZXJyb3JzLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9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