var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Router } from 'aurelia-router';
import { I18N } from 'aurelia-i18n';
import { autoinject } from "aurelia-framework";
import { ServiceBase } from "../../data/service-base";
import { FieldType, LocalityRessourceName, Various } from "../../model/common-model";
import { ListViewModelBase } from "../list-view-model-base";
import { GridHelper } from '../../resources/elements/ag-grid/grid-helper';
import { CustomLogger } from '../../modules/custom-logger';
import { EntityTypeNames } from '../../constants/constants';
export var CountryList = (function (_super) {
    __extends(CountryList, _super);
    function CountryList(router, logger, i18n) {
        var _this = _super.call(this, router, logger, new ServiceBase(EntityTypeNames.Country)) || this;
        _this.ressourceName = LocalityRessourceName;
        return _this;
    }
    CountryList.prototype.addLocality = function () {
        this.navigateTo(this.routePrefix + Various.NewId);
    };
    CountryList.prototype.getDetailsUrl = function (self, entity) {
        if (entity && entity.id) {
            return this.routePrefix + entity.id;
        }
        return null;
    };
    Object.defineProperty(CountryList.prototype, "routePrefix", {
        get: function () {
            return this.router.routes.find(function (x) { return x.name == 'country-detail'; }).href.replace('' + Various.NewId, '');
        },
        enumerable: false,
        configurable: true
    });
    CountryList.prototype.getDataGridColumns = function () {
        var isSelectedCol = GridHelper.getSelectedColDef(this);
        var defs = [
            isSelectedCol,
            {
                headerName: this.i18n.tr("common:country.code"),
                field: "code",
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("common:country.region"),
                field: "region",
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("common:country.isFavorite"),
                field: "isFavorite",
                type: FieldType.Boolean
            },
            {
                headerName: this.i18n.tr("common:country.isEU"),
                field: "isEU",
                type: FieldType.Boolean
            },
            {
                headerName: this.i18n.tr("common:locality.name") + this.i18n.tr("general.inBracketsFR"),
                field: "name.lang1",
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("common:locality.name") + this.i18n.tr("general.inBracketsNL"),
                field: "name.lang2",
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("common:locality.name") + this.i18n.tr("general.inBracketsEN"),
                field: "name.lang3",
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("general.createdTime"),
                field: "createdTime",
                hide: true,
                type: FieldType.Date
            },
            {
                headerName: this.i18n.tr("general.updatedTime"),
                field: "updatedTime",
                hide: true,
                type: FieldType.Date
            },
            {
                headerName: this.i18n.tr("general.createdByFullName"),
                field: "createdByFullName",
                hide: true,
                type: FieldType.String
            },
            {
                headerName: this.i18n.tr("general.updatedByFullName"),
                field: "updatedByFullName",
                hide: true,
                type: FieldType.String
            }
        ];
        return defs;
    };
    CountryList.prototype.importCountries = function () {
        this.router.navigateToRoute('import-data', { "context": "country", "errorView": "/node_modules/digiwall-lib/src/vm/countries/country-error.html" });
    };
    CountryList = __decorate([
        autoinject,
        __metadata("design:paramtypes", [Router, CustomLogger, I18N])
    ], CountryList);
    return CountryList;
}(ListViewModelBase));

//# sourceMappingURL=country-list.js.map
