"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const migrate_1 = require("./migrate");
const routes_1 = require("./routes");
const manifest_json_1 = __importDefault(require("./manifest.json"));
const plugin = {
    manifest: manifest_json_1.default,
    async activate(ctx) {
        // 1. Cria tabelas e seed inicial
        await (0, migrate_1.runMigrations)(ctx.db);
        ctx.logger.info('[secretaria] Tabelas criadas/verificadas');
        // 2. Registra rotas REST
        const router = (0, routes_1.createSecretariaRoutes)(ctx.db, ctx.config);
        ctx.app.use('/api/secretaria', router);
        ctx.logger.info('[secretaria] Rotas registradas em /api/secretaria');
    },
    async deactivate(ctx) {
        ctx.logger.info('[secretaria] Desativado');
    },
};
exports.default = plugin;
//# sourceMappingURL=index.js.map