<?php

namespace MintyPHP\Tests\Architecture;

/**
 * Registry of Grid.js list pages that expose a CSV/Excel export. Every
 * entry carries enough context for ListExportContractTest to verify:
 *
 *  - endpoint        → the export action file (must use exportSendCsv + co.)
 *  - data_endpoint   → the matching data() file (shares filter-schema.php)
 *  - filter_schema   → the schema file both endpoints must call
 *  - index_template  → the list page view (must include the dropdown partial)
 *  - page_module     → the front-end module (must call initListExport)
 *  - route_path      → the source path used by endpointUrl() / lurl
 *
 * Adding a new list export = add one entry here. The test will then
 * enforce the full contract without any per-list bespoke code.
 */
trait ListExportContractFiles
{
    /**
     * @return list<array{
     *   endpoint: string,
     *   data_endpoint: string,
     *   filter_schema: string,
     *   index_template: string,
     *   page_module: string,
     *   route_path: string
     * }>
     */
    private function listExportRegistry(): array
    {
        return [
            [
                'endpoint' => 'modules/helpdesk/pages/helpdesk/domains/export().php',
                'data_endpoint' => 'modules/helpdesk/pages/helpdesk/domains-data().php',
                'filter_schema' => 'modules/helpdesk/pages/helpdesk/domains/filter-schema.php',
                'index_template' => 'modules/helpdesk/pages/helpdesk/domains/index(default).phtml',
                'page_module' => 'modules/helpdesk/web/js/pages/helpdesk-domains-index.js',
                'route_path' => 'helpdesk/domains/export',
            ],
            [
                'endpoint' => 'pages/admin/users/export().php',
                'data_endpoint' => 'pages/admin/users/data().php',
                'filter_schema' => 'pages/admin/users/filter-schema.php',
                'index_template' => 'pages/admin/users/index(default).phtml',
                'page_module' => 'web/js/pages/app-users-list.js',
                'route_path' => 'admin/users/export',
            ],
            [
                'endpoint' => 'modules/audit/pages/audit/system-audit/export().php',
                'data_endpoint' => 'modules/audit/pages/audit/system-audit/data().php',
                'filter_schema' => 'modules/audit/pages/audit/system-audit/filter-schema.php',
                'index_template' => 'modules/audit/pages/audit/system-audit/index(default).phtml',
                'page_module' => 'modules/audit/web/js/pages/admin-system-audit-index.js',
                'route_path' => 'admin/system-audit/export',
            ],
        ];
    }
}
