<?php

namespace IvyForms\Services\Changelog;

class ChangelogService
{
    /**
     * Get changelog data with translated strings.
     *
     * @return array{
     *     version: string,
     *     release_date: string,
     *     features: array<array{text: string}>,
     *     improvements: array<array{text: string}>,
     *     bugfixes: array<array{text: string}>
     * }
     */
    public static function getChangelogData(): array
    {
        $changelogData = [
            'version' => IVYFORMS_VERSION,
            'release_date' => '05.05.2026.',
            'features' => [
                ['text' => __('Added form styling options, so you can now fully customize your forms!', 'ivyforms')],
                ['text' => __('Forms import and export.', 'ivyforms')],
                ['text' => __('Elementor integration.', 'ivyforms')],
                ['text' => __('Integration with Angie AI (Elementor AI Agent).', 'ivyforms')],
            ],
            'improvements' => [
                ['text' => __('Lazy loading implemented for templates.', 'ivyforms')],
                ['text' => __('All hover actions are available from the three-dots menu.', 'ivyforms')],
                ['text' => __('“Show empty fields” option in notification settings.', 'ivyforms')],
                ['text' => __('Increased description field length.', 'ivyforms')],
            ],
            'bugfixes' => [
                ['text' => __('Fixed missing last column on tablet resolution.', 'ivyforms')],
                ['text' => __('Fixed required validation message displaying incorrectly.', 'ivyforms')],
                ['text' => __('Fixed email confirmation options.', 'ivyforms')],
                ['text' => __('Fixed hover behavior over pages in the form builder.', 'ivyforms')],
                ['text' => __('Fixed sorting on the Author column.', 'ivyforms')],
                ['text' => __('Fixed calendar picker.', 'ivyforms')],
                ['text' => __('Fixed multiple submits when the Submit button was clicked repeatedly.', 'ivyforms')],
                ['text' => __('Fixed missing label and divider for column
                 visibility on the Results page.', 'ivyforms')],
                ['text' => __('Fixed Date Submitted column showing 
                the current date instead of the entry date.', 'ivyforms')],
                ['text' => __('Fixed disabling fields inside the Address field.', 'ivyforms')],
                ['text' => __('Fixed conflict with certain roles and IvyForms.', 'ivyforms')],
                ['text' => __('Fixed integration logic with wpDataTables.', 'ivyforms')],
            ],
        ];

        /**
         * Filter changelog data to allow Pro plugin to add its own changelog entries
         *
         * @param array $changelogData The changelog data array
         * @return array Modified changelog data
         */
        return apply_filters('ivyforms/changelog/get_data', $changelogData);
    }
}
