import { f as defineAdminEventHandler, h as requireAdminRole, j as getQuery, c as createError, db as getOutdatedTranslations } from '../../../../nitro/nitro.mjs';
import 'node:crypto';
import 'jsonwebtoken';
import 'node:fs';
import 'node:module';
import 'node:path';
import 'node:url';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'pino';
import 'drizzle-orm/better-sqlite3';
import 'drizzle-orm/node-postgres';
import 'drizzle-orm/mysql2';
import 'better-sqlite3';
import 'pg';
import 'mysql2/promise';
import 'drizzle-orm';
import 'fs';
import 'path';
import 'prom-client';
import 'bcryptjs';
import '@node-rs/argon2';
import 'node:async_hooks';
import 'crypto';
import 'node:dns';
import 'node:util';
import 'node:net';
import 'fs/promises';
import 'url';
import 'semver';

const outdated_get = defineAdminEventHandler("admin:translations:outdated", async (event) => {
  try {
    await requireAdminRole(event, ["super-admin", "admin", "editor"]);
    const query = getQuery(event);
    const contentType = query.contentType || void 0;
    const locale = query.locale || void 0;
    const limit = query.limit ? parseInt(query.limit, 10) : 50;
    const offset = query.offset ? parseInt(query.offset, 10) : 0;
    if (limit < 1 || limit > 200 || Number.isNaN(limit)) {
      throw createError({
        statusCode: 400,
        statusMessage: "Bad Request",
        message: "limit must be between 1 and 200"
      });
    }
    if (offset < 0 || Number.isNaN(offset)) {
      throw createError({
        statusCode: 400,
        statusMessage: "Bad Request",
        message: "offset must be >= 0"
      });
    }
    const result = await getOutdatedTranslations({ contentType, locale, limit, offset });
    return {
      success: true,
      data: result.items,
      meta: {
        total: result.total,
        limit,
        offset
      }
    };
  } catch (error) {
    if (error && typeof error === "object" && "statusCode" in error) {
      throw error;
    }
    console.error("[GET /api/admin/translations/outdated] Error:", error);
    throw createError({
      statusCode: 500,
      statusMessage: "Failed to get outdated translations",
      message: error instanceof Error ? error.message : "Unknown error"
    });
  }
});

export { outdated_get as default };
//# sourceMappingURL=outdated.get.mjs.map
