"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseRoutes = void 0;
var lodash_1 = require("lodash");
var BaseService_1 = __importDefault(require("./BaseService"));
var CrudService_1 = __importDefault(require("./CrudService"));
var BaseRoutes;
(function (BaseRoutes) {
    BaseRoutes["Get"] = "get";
    BaseRoutes["GetAll"] = "getAll";
    BaseRoutes["Create"] = "create";
    BaseRoutes["Update"] = "update";
    BaseRoutes["Delete"] = "delete";
    BaseRoutes["Patch"] = "patch";
})(BaseRoutes = exports.BaseRoutes || (exports.BaseRoutes = {}));
var defaultRoutes = [
    BaseRoutes.Get,
    BaseRoutes.GetAll,
    BaseRoutes.Update,
    BaseRoutes.Create,
    BaseRoutes.Delete,
    BaseRoutes.Patch
];
var Entity = /** @class */ (function () {
    function Entity(_a) {
        var session = _a.session, entityName = _a.entityName, routes = _a.routes, routePrefix = _a.routePrefix, routeSuffix = _a.routeSuffix;
        var _this = this;
        this.service = new BaseService_1.default(session, entityName);
        var crudService = new CrudService_1.default(session, entityName, routePrefix, routeSuffix);
        if ((0, lodash_1.isArray)(routes) && (0, lodash_1.isEmpty)(routes)) {
            routes = defaultRoutes;
        }
        (0, lodash_1.each)(routes, function (route) {
            _this.service[route] = crudService[route];
        });
    }
    return Entity;
}());
exports.default = Entity;
//# sourceMappingURL=Entity.js.map