import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import { InputLabel } from '../../mixins/input-label/input-label';
import { InputManagement } from '../../mixins/input-management/input-management';
import { InputState } from '../../mixins/input-state/input-state';
import { InputWidth } from '../../mixins/input-width/input-width';
import uuid from '../../utils/uuid/uuid';
import { ModulVue } from '../../utils/vue/vue';
import { POSTALCODEFIELD_NAME } from '../component-names';
import { MMaskedfield } from '../maskedfield/maskedfield';
import WithRender from './postalcodefield.html';
export var MPostalCodeCountry;
(function (MPostalCodeCountry) {
    MPostalCodeCountry["CA"] = "ca";
    MPostalCodeCountry["FR"] = "fr";
    MPostalCodeCountry["Other"] = "other";
    MPostalCodeCountry["US"] = "us";
})(MPostalCodeCountry || (MPostalCodeCountry = {}));
var MPostalcodefield = /** @class */ (function (_super) {
    __extends(MPostalcodefield, _super);
    function MPostalcodefield() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.id = "mPostalcodefield-" + uuid.generate();
        return _this;
    }
    Object.defineProperty(MPostalcodefield.prototype, "maskOptions", {
        get: function () {
            switch (this.postalCodeFormat.toLowerCase()) {
                case MPostalCodeCountry.CA:
                    return {
                        blocks: [3, 3],
                        delimiter: ' ',
                        delimiterLazyShow: true,
                        uppercase: true
                    };
                case MPostalCodeCountry.FR:
                    return {
                        blocks: [5],
                        numericOnly: true,
                        uppercase: true
                    };
                case MPostalCodeCountry.US:
                    return {
                        blocks: [5, 4],
                        delimiter: '-',
                        delimiterLazyShow: true,
                        numericOnly: true,
                        uppercase: true
                    };
                case MPostalCodeCountry.Other:
                default:
                    // Infinite value to display normally with no space the default values, if value is other or invalid!
                    return {
                        blocks: [1e+23],
                        uppercase: true
                    };
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MPostalcodefield.prototype, "bindData", {
        get: function () {
            return Object.assign({}, this.$props || {}, this.$attrs || {});
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop({ default: MPostalCodeCountry.CA })
    ], MPostalcodefield.prototype, "postalCodeFormat", void 0);
    MPostalcodefield = __decorate([
        WithRender,
        Component({
            components: {
                MMaskedfield: MMaskedfield
            },
            mixins: [
                InputState,
                InputWidth,
                InputLabel,
                InputManagement
            ]
        })
    ], MPostalcodefield);
    return MPostalcodefield;
}(ModulVue));
export { MPostalcodefield };
var PostalcodefieldPlugin = {
    install: function (v) {
        v.component(POSTALCODEFIELD_NAME, MPostalcodefield);
    }
};
export default PostalcodefieldPlugin;
//# sourceMappingURL=postalcodefield.js.map