import { getV3Route } from '../../_lib/registry';
import { requireV3X402Release } from '../../_lib/release';

const route = getV3Route('retired-partnership-write');
if (route.method !== 'POST' || route.path !== '/api/v3/x402/actions/create-partnership-bond') {
  throw new Error('V3 retirement handler registry binding is invalid');
}

export function POST(request: Request): Response {
  const closed = requireV3X402Release();
  if (closed) return closed;
  void request;
  return Response.json({
    schema: 'vaultfire.v3.x402.retirement.v1',
    schemaVersion: '1.0.0',
    protocolVersion: '3.0.0',
    route: route.path,
    status: 'retired',
    executable: false,
    paymentChallengeAvailable: false,
    requestInspected: false,
    bodyParsed: false,
    reason: 'mission-sensitive-custody-surface-retired',
    safety: { v2FallbackUsed: false, paymentParsed: false, writeAttempted: false },
  }, {
    status: 503,
    headers: { 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' },
  });
}
