import { Component, Input } from '@angular/core';
import { FormControl } from '@angular/forms';
import { AbstractFieldReadComponent } from '../base-field/abstract-field-read.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
function ReadMoneyGbpFieldComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "span", 1);
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "currency");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind3(3, 1, ctx_r0.value / 100, "GBP", "symbol"));
} }
export class ReadMoneyGbpFieldComponent extends AbstractFieldReadComponent {
    amount;
    value;
    ngOnInit() {
        if (this.amount) {
            this.value = this.amount;
        }
        else if (this.caseField) {
            this.registerControl(new FormControl(this.caseField.value));
            this.value = this.caseField.value;
        }
    }
    isNumber() {
        return null !== this.value && !isNaN(this.value);
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵReadMoneyGbpFieldComponent_BaseFactory; return function ReadMoneyGbpFieldComponent_Factory(__ngFactoryType__) { return (ɵReadMoneyGbpFieldComponent_BaseFactory || (ɵReadMoneyGbpFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadMoneyGbpFieldComponent)))(__ngFactoryType__ || ReadMoneyGbpFieldComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadMoneyGbpFieldComponent, selectors: [["ccd-read-money-gbp-field"]], inputs: { amount: "amount" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[4, "ngIf"], [1, "text-16"]], template: function ReadMoneyGbpFieldComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, ReadMoneyGbpFieldComponent_ng_container_0_Template, 4, 5, "ng-container", 0);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.isNumber());
        } }, dependencies: [i1.NgIf, i1.CurrencyPipe], encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadMoneyGbpFieldComponent, [{
        type: Component,
        args: [{
                selector: 'ccd-read-money-gbp-field',
                template: `<ng-container *ngIf="isNumber()"><span class="text-16">{{value / 100 | currency:'GBP':'symbol'}}</span></ng-container>`
            }]
    }], null, { amount: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ReadMoneyGbpFieldComponent, { className: "ReadMoneyGbpFieldComponent", filePath: "lib/shared/components/palette/money-gbp/read-money-gbp-field.component.ts", lineNumber: 9 }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhZC1tb25leS1nYnAtZmllbGQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY2NkLWNhc2UtdWktdG9vbGtpdC9zcmMvbGliL3NoYXJlZC9jb21wb25lbnRzL3BhbGV0dGUvbW9uZXktZ2JwL3JlYWQtbW9uZXktZ2JwLWZpZWxkLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBVSxNQUFNLGVBQWUsQ0FBQztBQUN6RCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDN0MsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sNkNBQTZDLENBQUM7Ozs7SUFJNUUsNkJBQWlDO0lBQUEsK0JBQXNCO0lBQUEsWUFBeUM7O0lBQUEsaUJBQU87Ozs7SUFBaEQsZUFBeUM7SUFBekMsK0VBQXlDOztBQUU3RyxNQUFNLE9BQU8sMEJBQTJCLFNBQVEs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