/**
 * Forms Page - List view and Form Builder
 */

import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import FormBuilder from '../components/formBuilder/FormBuilder';

export default function FormsPage({ initialData }) {
    const [isBuilder, setIsBuilder] = useState(false);
    const [selectedFormId, setSelectedFormId] = useState(null);

    if (isBuilder) {
        return (
            <div className="formipay-page-forms">
                <FormBuilder
                    formId={selectedFormId}
                    initialData={initialData}
                />
            </div>
        );
    }

    return (
        <div className="formipay-page-forms">
            <div className="formipay-forms-list">
                <h1>{ __('Forms', 'formipay') }</h1>
                <p>{ __('Forms list coming soon. Use the classic editor for now.', 'formipay') }</p>
            </div>
        </div>
    );
}
