import { h } from "@stencil/core";
import classNames from "classnames";
import { DataTestIdsEnum } from "../../../constants/dataTestIds.enum";
export class FormatAmount {
    constructor() {
        this.showLabel = true;
    }
    render() {
        return this.isValid ? this.renderValid() : this.renderInvalid();
    }
    renderInvalid() {
        var _a;
        return (h("span", { "data-testid": (_a = this.dataTestId) !== null && _a !== void 0 ? _a : DataTestIdsEnum.formatAmountComponent, class: this.class }, h("span", { class: "int-amount", "data-testid": DataTestIdsEnum.formatAmountInt }, "...")));
    }
    renderValid() {
        return (h("span", { "data-testid": this.dataTestId, class: classNames(this.class, 'format-amount') }, h("span", { class: "int-amount", "data-testid": DataTestIdsEnum.formatAmountInt }, this.valueInteger), this.valueDecimal && (h("span", { class: "decimals", "data-testid": DataTestIdsEnum.formatAmountDecimals }, this.valueDecimal)), this.showLabel && this.label && (h("span", { class: {
                symbol: true,
                [this.labelClass]: Boolean(this.labelClass),
            }, "data-testid": DataTestIdsEnum.formatAmountSymbol }, this.label))));
    }
    static get is() { return "format-amount"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["format-amount.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["format-amount.css"]
        };
    }
    static get properties() {
        return {
            "class": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "class",
                "reflect": false
            },
            "dataTestId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "data-test-id",
                "reflect": false
            },
            "isValid": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "is-valid",
                "reflect": false
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "label",
                "reflect": false
            },
            "labelClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "label-class",
                "reflect": false
            },
            "showLabel": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "show-label",
                "reflect": false,
                "defaultValue": "true"
            },
            "valueDecimal": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "value-decimal",
                "reflect": false
            },
            "valueInteger": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "value-integer",
                "reflect": false
            }
        };
    }
}
//# sourceMappingURL=format-amount.js.map
