<?php

/**
 * Domain Verification API Routes
 */

if (!defined('ABSPATH')) {
  exit;
}

require_once dirname(__FILE__) . '/verification-handler.php';

/**
 * Register verification API routes
 */
function content_craft_ai_register_verification_routes()
{
  // Get verification token - public endpoint
  register_rest_route('content-craft-ai/v1', '/verification', array(
    'methods'  => 'GET',
    'callback' => 'content_craft_ai_get_verification',
    'permission_callback' => '__return_true', // Public endpoint
  ));

  // Set verification token - using secure key
  register_rest_route('content-craft-ai/v1', '/verification', array(
    'methods'  => 'POST',
    'callback' => 'content_craft_ai_set_verification',
    'permission_callback' => '__return_true', // Public but validated in handler
  ));

  // Delete verification token - using secure key
  register_rest_route('content-craft-ai/v1', '/verification', array(
    'methods'  => 'DELETE',
    'callback' => 'content_craft_ai_delete_verification',
    'permission_callback' => '__return_true', // Public but validated in handler
  ));
}

add_action('rest_api_init', 'content_craft_ai_register_verification_routes');
