"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const routes_1 = require("./backend/routes");
const manifest_json_1 = __importDefault(require("./manifest.json"));
const plugin = {
    manifest: manifest_json_1.default,
    async activate(ctx) {
        const router = (0, routes_1.createLeadsRoutes)(ctx);
        ctx.app.use('/api/leads', router);
        ctx.hooks.register('user:register', async (data) => {
            await ctx.db('leads').insert({
                user_id: data.userId,
                source: 'registration',
                status: 'new',
                lead_type: 'member',
            }).catch(() => { });
        });
        ctx.logger.info('Leads routes registered');
    },
    async deactivate(ctx) { ctx.logger.info('Leads deactivated'); },
};
exports.default = plugin;
//# sourceMappingURL=index.js.map