import { Hono } from 'hono'
import { handleAnomalousSpend } from './anomalous-spend.ts'
import { handleDashboard } from './dashboard.ts'
import { handleFeed } from './feed.ts'
import { handleGetRun, handleListRuns } from './runs.ts'
import { handleGetThread, handleListThreads } from './threads.ts'
import { handleTapFrame } from './tap.ts'
import {
  handleDeletePricing,
  handleGetPricing,
  handlePostPricing,
} from './pricing.ts'
import { handlePrune } from './prune.ts'
import {
  handleDeleteAgent,
  handleDeleteCapability,
  handleDeleteModel,
  handleDeleteProvider,
  handleDeleteSecret,
  handleGetPolicy,
  handleGetRegistry,
  handleGetSpend,
  handlePostAgent,
  handlePostCapability,
  handlePostListModels,
  handlePostModel,
  handlePostProvider,
  handlePostProviderEffort,
  handlePostSecret,
  handlePostSubagent,
} from './routing.ts'
import {
  handleDeleteToolProvider,
  handleGetToolProviders,
  handlePostActiveToolProvider,
  handlePostToolProvider,
} from './tool-providers.ts'
import { handleThomas } from './thomas.ts'
import { handleTools } from './tools.ts'
import {
  handleGetUpdate,
  handlePostUpdate,
  handlePostUpdateCheck,
  handlePostUpdatePreference,
} from './update.ts'
import { handleWireDetect, handleWireRun, handleWireStatus, handleWireUnwire } from './wire.ts'

export const api = new Hono()

api.get('/runs', handleListRuns)
api.get('/runs/:id', handleGetRun)
api.get('/threads', handleListThreads)
api.get('/threads/:id', handleGetThread)
api.get('/feed', handleFeed)
api.get('/wire/status', handleWireStatus)
api.get('/wire/detect', handleWireDetect)
api.post('/wire/run', handleWireRun)
api.post('/wire/unwire', handleWireUnwire)
api.get('/anomalous-spend', handleAnomalousSpend)
api.get('/dashboard', handleDashboard)
api.get('/thomas', handleThomas)
api.get('/tools', handleTools)
api.get('/prune', handlePrune)
api.post('/prune', handlePrune)
api.get('/pricing', handleGetPricing)
api.post('/pricing/custom', handlePostPricing)
api.delete('/pricing/custom', handleDeletePricing)
api.get('/routing/registry', handleGetRegistry)
api.post('/routing/provider', handlePostProvider)
api.post('/routing/provider/effort', handlePostProviderEffort)
api.delete('/routing/provider', handleDeleteProvider)
api.post('/routing/model', handlePostModel)
api.delete('/routing/model', handleDeleteModel)
api.post('/routing/list-models', handlePostListModels)
api.get('/routing/policy', handleGetPolicy)
api.post('/routing/subagent', handlePostSubagent)
api.post('/routing/agent', handlePostAgent)
api.delete('/routing/agent', handleDeleteAgent)
api.post('/routing/capability', handlePostCapability)
api.delete('/routing/capability', handleDeleteCapability)
api.post('/routing/secret', handlePostSecret)
api.delete('/routing/secret', handleDeleteSecret)
api.get('/routing/spend', handleGetSpend)
api.get('/tool-providers', handleGetToolProviders)
api.post('/tool-providers', handlePostToolProvider)
api.delete('/tool-providers', handleDeleteToolProvider)
api.post('/tool-providers/active', handlePostActiveToolProvider)
api.post('/tap/frame', handleTapFrame)
api.get('/update', handleGetUpdate)
api.post('/update', handlePostUpdate)
api.post('/update/check', handlePostUpdateCheck)
api.post('/update/preference', handlePostUpdatePreference)
