import { ChangeDetectionStrategy, Component, Inject, Optional } from '@angular/core';
import { documentLink, MatomoService } from '@aztrix/helpers';
import { CommunicationType } from '@aztrix/models';
import { BASE_URL } from '@aztrix/sdk';
import { AbstractPropertyValueViewComponent } from '../abstract-property-value-view.component';
import * as i0 from "@angular/core";
import * as i1 from "@aztrix/helpers";
import * as i2 from "@angular/common";
import * as i3 from "../default-value-view/default-value-view.component";
export class DocumentValueViewComponent extends AbstractPropertyValueViewComponent {
    constructor(baseUrl, _matomo) {
        super();
        this.baseUrl = baseUrl;
        this._matomo = _matomo;
    }
    downloadPdf() {
        this._trackClick();
        window.open(this.baseUrl + documentLink(this.property), '_blank');
    }
    _trackClick() {
        this._matomo.trackEvent('Document value', 'click', CommunicationType.URL.toLowerCase());
    }
}
DocumentValueViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DocumentValueViewComponent, deps: [{ token: BASE_URL, optional: true }, { token: i1.MatomoService }], target: i0.ɵɵFactoryTarget.Component });
DocumentValueViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: DocumentValueViewComponent, selector: "ax-document-value-view", usesInheritance: true, ngImport: i0, template: "<ng-template #view>\n  <ax-default-value-view\n    [property]=\"property\"\n    [showVerificationLabel]=\"showVerificationLabel\"\n    [clickable]=\"false\"\n  ></ax-default-value-view>\n</ng-template>\n\n<ng-container *ngIf=\"clickable; else view\">\n  <a\n    class=\"c-card__property__link\"\n    [href]=\"property | propertyDocumentLink\"\n    [attr.download]=\"(property | propertyDisplayValue) + '.pdf'\"\n    (click)=\"downloadPdf(); $event.preventDefault()\"\n  >\n    <ng-container *ngTemplateOutlet=\"view\"></ng-container>\n  </a>\n</ng-container>\n", styles: [".property-value{font-size:16px;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.DefaultValueViewComponent, selector: "ax-default-value-view" }, { kind: "pipe", type: i1.PropertyDisplayValuePipe, name: "propertyDisplayValue" }, { kind: "pipe", type: i1.PropertyDocumentLinkPipe, name: "propertyDocumentLink" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DocumentValueViewComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-document-value-view', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #view>\n  <ax-default-value-view\n    [property]=\"property\"\n    [showVerificationLabel]=\"showVerificationLabel\"\n    [clickable]=\"false\"\n  ></ax-default-value-view>\n</ng-template>\n\n<ng-container *ngIf=\"clickable; else view\">\n  <a\n    class=\"c-card__property__link\"\n    [href]=\"property | propertyDocumentLink\"\n    [attr.download]=\"(property | propertyDisplayValue) + '.pdf'\"\n    (click)=\"downloadPdf(); $event.preventDefault()\"\n  >\n    <ng-container *ngTemplateOutlet=\"view\"></ng-container>\n  </a>\n</ng-container>\n", styles: [".property-value{font-size:16px;font-weight:700}\n"] }]
        }], ctorParameters: function () { return [{ type: undefined, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [BASE_URL]
                }] }, { type: i1.MatomoService }]; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9jdW1lbnQtdmFsdWUtdmlldy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvcHJvcGVydHktdmlldy9kb2N1bWVudC12YWx1ZS12aWV3L2RvY3VtZW50LXZhbHVlLXZpZXcuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9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