import { d as defineEventHandler, i as debug, F as findActionableIssue } from '../../../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'path';
import 'fs/promises';
import 'child_process';
import 'node:child_process';
import 'node:url';

const actionable_get = defineEventHandler(async () => {
  var _a, _b, _c;
  debug("api", "GET /api/issues/actionable");
  const issue = await findActionableIssue();
  if (!issue) {
    debug("api", "GET /api/issues/actionable - none found");
    return {
      found: false,
      issue: null,
      message: "No actionable issue found. Move an issue from backlog to work columns."
    };
  }
  debug("api", "GET /api/issues/actionable - found", { key: issue.key, column: (_a = issue.column) == null ? void 0 : _a.slug });
  return {
    found: true,
    issue: {
      key: issue.key,
      title: issue.title,
      column_slug: (_c = (_b = issue.column) == null ? void 0 : _b.slug) != null ? _c : "",
      created_at: issue.createdAt.toISOString(),
      updated_at: issue.updatedAt.toISOString(),
      description: issue.description,
      priority: issue.priority,
      parent_key: issue.parentKey,
      acceptance_criteria: issue.acceptanceCriteria.map((c) => c.criterion)
    },
    message: null
  };
});

export { actionable_get as default };
//# sourceMappingURL=actionable.get.mjs.map
