'use strict';

var chunk5WFMCDP6_cjs = require('./chunk-5WFMCDP6.cjs');
var chunkY2BKW5ND_cjs = require('./chunk-Y2BKW5ND.cjs');
var chunk6P7P7Y5U_cjs = require('./chunk-6P7P7Y5U.cjs');
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
var zodToJson = require('@mastra/core/utils/zod-to-json');

var LIST_PROCESSOR_PROVIDERS_ROUTE = chunk6P7P7Y5U_cjs.createRoute({
  method: "GET",
  path: "/processor-providers",
  responseType: "json",
  responseSchema: chunk5WFMCDP6_cjs.getProcessorProvidersResponseSchema,
  summary: "List processor providers",
  description: "Returns a list of all registered processor providers with their info and available phases",
  tags: ["Processor Providers"],
  requiresAuth: true,
  handler: async ({ mastra }) => {
    try {
      const editor = mastra.getEditor();
      if (!editor) {
        throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Editor is not configured" });
      }
      const providers = editor.getProcessorProviders();
      return {
        providers: Object.values(providers).map((provider) => ({
          ...provider.info,
          availablePhases: provider.availablePhases
        }))
      };
    } catch (error) {
      return chunkY2BKW5ND_cjs.handleError(error, "Error listing processor providers");
    }
  }
});
var GET_PROCESSOR_PROVIDER_ROUTE = chunk6P7P7Y5U_cjs.createRoute({
  method: "GET",
  path: "/processor-providers/:providerId",
  responseType: "json",
  pathParamSchema: chunk5WFMCDP6_cjs.processorProviderIdPathParams,
  responseSchema: chunk5WFMCDP6_cjs.getProcessorProviderResponseSchema,
  summary: "Get processor provider details",
  description: "Returns details about a specific processor provider, including its configuration schema",
  tags: ["Processor Providers"],
  requiresAuth: true,
  handler: async ({ mastra, providerId }) => {
    try {
      const editor = mastra.getEditor();
      if (!editor) {
        throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Editor is not configured" });
      }
      const provider = editor.getProcessorProvider(providerId);
      if (!provider) {
        throw new chunk64ITUOXI_cjs.HTTPException(404, { message: `Processor provider with id ${providerId} not found` });
      }
      return {
        ...provider.info,
        availablePhases: provider.availablePhases,
        configSchema: zodToJson.zodToJsonSchema(provider.configSchema)
      };
    } catch (error) {
      return chunkY2BKW5ND_cjs.handleError(error, "Error getting processor provider");
    }
  }
});

exports.GET_PROCESSOR_PROVIDER_ROUTE = GET_PROCESSOR_PROVIDER_ROUTE;
exports.LIST_PROCESSOR_PROVIDERS_ROUTE = LIST_PROCESSOR_PROVIDERS_ROUTE;
//# sourceMappingURL=chunk-JGK2MALT.cjs.map
//# sourceMappingURL=chunk-JGK2MALT.cjs.map