<?php

namespace EasyLinkAutomations\HTTP\Controllers\Triggers;

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

use EasyLinkAutomations\HTTP\Request\Request;
use EasyLinkAutomations\HTTP\Response;

/**
 * Controller for Kadence Forms trigger endpoints.
 */
final class KadenceFormsController
{
    /**
     * Return form fields for a Kadence Blocks form.
     *
     * Route: kadence-forms/form-fields
     */
    public function formFields(Request $request): Response
    {
        $formId = (int) $request->get('form_id', 0);
        if ($formId <= 0) {
            return Response::error('form_id is required', 400);
        }

        // Kadence Forms are Gutenberg blocks. Return standard fields.
        $fields = [
            'form_id' => 'Form ID',
            'post_id' => 'Post ID',
        ];

        return Response::success(['fields' => $fields]);
    }
}
