<?php
/**
 * FilecheckerDashboard → File Integrity Checker overview page.
 *
 * Displays:
 *   • 4 stat-cards  (total files, changes, suspicious, quarantined)
 *   • Scan progress card with cancel button
 *   • Recent file changes data-table
 *   • Quick actions card
 *   • System status sidebar
 *   • File breakdown doughnut chart
 *
 * Schema contract: returns a pure PHP array → no raw HTML, no Closures.
 *
 * @package UltraguardPro\modules\filechecker\pages
 * @since   6.5.0
 */

namespace UltraguardPro\modules\filechecker\pages;

use UltraguardPro\Plugin;
use UltraguardPro\modules\core\BasePage;

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

class FilecheckerDashboard extends BasePage {

    public function __construct( Plugin $plugin ) {
        parent::__construct( $plugin );
        $this->ajax_nonce_action = 'ultraguard_admin_nonce';
    }

    // ── Main scheme ────────────────────────────────────────────────────────────

    public function get_scheme( $context ): array {
        $is_pro = \UltraguardPro\support\LicenseInfo::instance()->isPro();
        $preview_mode = $this->is_soft_gated_module_preview( 'filechecker' );

        $db   = $this->plugin->modules->get_db_tables();
        $fi   = $db ? $db->get_table( 'file_integrity' ) : null;
        $sess = $db ? $db->get_table( 'scan_sessions' )  : null;

        $summary   = $preview_mode ? $this->preview_summary() : ( $fi ? $fi->get_integrity_summary() : [] );
        $scan_stat = $preview_mode ? [ 'last_scan_at' => gmdate( 'Y-m-d H:i:s', time() - DAY_IN_SECONDS ) ] : ( $sess ? $sess->get_scan_statistics() : [] );

        $total      = (int) ( $summary['total']      ?? 0 );
        $changes    = (int) ( $summary['modified']   ?? 0 );
        $added      = (int) ( $summary['added']      ?? 0 );
        $suspicious = (int) ( $summary['suspicious'] ?? 0 );
        $quarantine = (int) ( $summary['quarantined']?? 0 );
        $last_scan  = (string) ( $scan_stat['last_scan_at'] ?? '' );

        $progress    = $preview_mode ? null : get_transient( 'ultraguard_fc_scan_in_progress' );
        $is_scanning = ! empty( $progress );
        $scan_pct    = $is_scanning ? (int) ( $progress['percent'] ?? 0 ) : 0;
        $scan_type   = $is_scanning ? ucfirst( $progress['type']   ?? 'full' ) : '';

        $recent = $preview_mode ? $this->preview_recent_changes() : ( $fi ? $fi->get_by(
            [ 'status IN' => [ 'modified', 'suspicious', 'added' ] ],
            8,
            'last_checked_at',
            'DESC'
        ) : [] );

        $nonce = $this->create_nonce( 'ultraguard_admin_nonce' );

        return apply_filters( 'ultraguard_filechecker_dashboard_scheme', [
            'type'      => 'page',
            'id'        => 'ultraguard-filechecker-dashboard',
            'page_slug' => 'filechecker',
            'class'     => 'ultraguard-filechecker-dashboard-page',

            'header' => [
                'title'    => __( 'File Integrity Checker', 'ultraguard-security-suite' ),
                'subtitle' => __( 'Monitor file changes and detect unauthorised modifications across your WordPress installation.', 'ultraguard-security-suite' ),
                'badge'    => [
                    'text'       => $is_scanning ? ( $scan_type . ' ' . __( 'Scan Running', 'ultraguard-security-suite' ) ) : __( 'Idle', 'ultraguard-security-suite' ),
                    'badge_type' => $is_scanning ? 'info' : 'success',
                ],
                'actions' => [
                    [
                        'type'         => 'button',
                        'text'         => __( 'Quick Scan', 'ultraguard-security-suite' ),
                        'button_style' => 'primary',
                        'icon'         => 'dashicons-clock',
                        'disabled'     => $is_scanning,
                        'ajax'         => [
                            'action'  => 'ultraguard_fc_start_quick_scan',
                            'nonce'   => $nonce,
                        ],
                    ],
                    [
                        'type'         => 'button',
                        'text'         => __( 'Full System Scan', 'ultraguard-security-suite' ),
                        'button_style' => 'secondary',
                        'icon'         => 'dashicons-search',
                        'disabled'     => $is_scanning,
                        'ajax'         => [
                            'action'  => 'ultraguard_fc_start_full_scan',
                            'nonce'   => $nonce,
                            'confirm' => __( 'Start a full system integrity check? This may take several minutes.', 'ultraguard-security-suite' ),
                        ],
                    ],
                ],
            ],

            'data' => array_values( array_filter( [
                // Pro upsell card — shown only to free users, auto-hidden for Pro
                ! $is_pro ? $this->pro_upsell_card( 'file_integrity_scan' ) : [],
                $preview_mode ? $this->soft_gated_preview_data_notice(
                    __( 'File Integrity Checker', 'ultraguard-security-suite' ),
                    __( 'These changed files, quarantine counts, and scan summaries are sample integrity records. Upgrade to scan your live filesystem and review real modifications safely.', 'ultraguard-security-suite' )
                ) : [],

                // Row 1 → stat cards
                $this->stat_row( $total, $changes, $added, $suspicious, $quarantine ),

                // Row 2 → main content + sidebar
                [
                    'type'    => 'grid',
                    'columns' => 12,
                    'gap'     => '20px',
                    'items'   => [
                        [
                            'span'      => 8,
                            'responsive'=> [ 'md' => 12, 'lg' => 8 ],
                            'component' => [
                                'type'    => 'grid',
                                'columns' => 1,
                                'gap'     => '20px',
                                'items'   => [
                                    [ 'component' => $this->scan_progress_card( $is_scanning, $scan_pct, $scan_type, $nonce ) ],
                                    [ 'component' => $this->recent_changes_card( $recent, $nonce ) ],
                                    [ 'component' => $this->quick_actions_card( $nonce, $is_scanning ) ],
                                ],
                            ],
                        ],
                        [
                            'span'      => 4,
                            'responsive'=> [ 'md' => 12, 'lg' => 4 ],
                            'component' => [
                                'type'    => 'grid',
                                'columns' => 1,
                                'gap'     => '20px',
                                'items'   => [
                                    [ 'component' => $this->status_card( $last_scan ) ],
                                    [ 'component' => $this->navigation_card() ],
                                    [ 'component' => $this->breakdown_chart( $summary ) ],
                                ],
                            ],
                        ],
                    ],
                ],
            ] ) ),

            'form' => [ 'enable' => false ],
        ], $context );
    }

    // ── Widget builders ────────────────────────────────────────────────────────

    /**
     * Build the four top stat-cards.
     */
    private function stat_row( int $total, int $changes, int $added, int $suspicious, int $quarantine ): array {
        return [
            'type'       => 'grid',
            'columns'    => 12,
            'gap'        => '16px',
            'responsive' => true,
            'items'      => [
                [
                    'span'      => 3,
                    'responsive'=> [ 'sm' => 12, 'md' => 6, 'lg' => 3 ],
                    'component' => [
                        'type'   => 'stat-card',
                        'title'  => __( 'Total Files', 'ultraguard-security-suite' ),
                        'value'  => $total,
                        'format' => 'number',
                        'icon'   => 'dashicons-media-document',
                        'class'  => 'info',
                        'hide_when_empty' => true,
                    ],
                ],
                [
                    'span'      => 3,
                    'responsive'=> [ 'sm' => 12, 'md' => 6, 'lg' => 3 ],
                    'component' => [
                        'type'   => 'stat-card',
                        'title'  => __( 'Changes Found', 'ultraguard-security-suite' ),
                        'value'  => $changes + $added,
                        'format' => 'number',
                        'icon'   => 'dashicons-warning',
                        'class'  => ( $changes + $added ) > 0 ? 'warning' : 'success',
                        'trend'  => $added > 0
                            ? [ 'direction' => 'up', 'value' => $added, 'text' => __( 'new files', 'ultraguard-security-suite' ) ]
                            : [],
                        'hide_when_empty' => true,
                    ],
                ],
                [
                    'span'      => 3,
                    'responsive'=> [ 'sm' => 12, 'md' => 6, 'lg' => 3 ],
                    'component' => [
                        'type'   => 'stat-card',
                        'title'  => __( 'Suspicious Files', 'ultraguard-security-suite' ),
                        'value'  => $suspicious,
                        'format' => 'number',
                        'icon'   => 'dashicons-shield-alt',
                        'class'  => $suspicious > 0 ? 'danger' : 'success',
                        'hide_when_empty' => true,
                    ],
                ],
                [
                    'span'      => 3,
                    'responsive'=> [ 'sm' => 12, 'md' => 6, 'lg' => 3 ],
                    'component' => [
                        'type'   => 'stat-card',
                        'title'  => __( 'In Quarantine', 'ultraguard-security-suite' ),
                        'value'  => $quarantine,
                        'format' => 'number',
                        'icon'   => 'dashicons-lock',
                        'class'  => $quarantine > 0 ? 'danger' : 'success',
                        'hide_when_empty' => true,
                    ],
                ],
            ],
        ];
    }

    /**
     * Build the scan progress card with table layout and correct CSS classes.
     */
    private function scan_progress_card( bool $is_scanning, int $pct, string $scan_type, string $nonce ): array {
        $card = [
            'type'  => 'card',
            'id'    => 'fc-scan-progress-card',
            'title' => __( 'Scan Status', 'ultraguard-security-suite' ),
            'icon'  => 'dashicons-update',
            'badge' => [
                'text'       => $is_scanning ? ( $scan_type . ' — ' . __( 'Running…', 'ultraguard-security-suite' ) ) : __( 'Idle', 'ultraguard-security-suite' ),
                'badge_type' => $is_scanning ? 'warning' : 'secondary',
            ],
            'data'  => [
                [
                    'type'          => 'progress',
                    'id'            => 'fc-scan-progress-bar',
                    'class'         => $is_scanning ? '' : 'fc-hidden',
                    'value'         => $pct,
                    'max'           => 100,
                    'progress_type' => 'bar',
                    'status'        => $is_scanning ? 'primary' : 'secondary',
                    'animated'      => $is_scanning,
                    'striped'       => $is_scanning,
                    'label'         => $is_scanning
                        /* translators: %d: integer */
                        ? sprintf( __( 'Scanning… %d%%', 'ultraguard-security-suite' ), $pct )
                        : __( 'Scanning… 0%', 'ultraguard-security-suite' ),
                    'show_value'    => true,
                ],
                [
                    'type'  => 'list',
                    'class' => $is_scanning ? 'fc-live-stats-row' : 'fc-live-stats-row fc-hidden',
                    'items' => [
                        [
                            'icon'  => 'dashicons-update',
                            'text'  => __( 'Live — Files', 'ultraguard-security-suite' ),
                            'badge' => [ 'text' => '0', 'badge_type' => 'info' ],
                        ],
                        [
                            'icon'  => 'dashicons-hammer',
                            'text'  => __( 'Live — Changes', 'ultraguard-security-suite' ),
                            'badge' => [ 'text' => '0', 'badge_type' => 'warning' ],
                        ],
                        [
                            'icon'  => 'dashicons-clock',
                            'text'  => __( 'Live — Elapsed', 'ultraguard-security-suite' ),
                            'badge' => [ 'text' => '0s', 'badge_type' => 'secondary' ],
                        ],
                    ],
                ],
                [
                    'type'    => 'paragraph',
                    'class'   => $is_scanning ? 'fc-current-file' : 'fc-current-file fc-hidden',
                    'content' => '',
                ],
                [
                    'type'    => 'paragraph',
                    'class'   => $is_scanning ? 'fc-hidden' : 'ug-scan-status-note',
                    'content' => __( 'No scan in progress.', 'ultraguard-security-suite' ),
                ],
            ],
        ];

        if ( $is_scanning ) {
            $card['footer'] = [
                'type'      => 'button-group',
                'alignment' => 'center',
                'buttons'   => [ [
                    'type'         => 'button',
                    'text'         => __( 'Cancel Scan', 'ultraguard-security-suite' ),
                    'button_style' => 'warning',
                    'icon'         => 'dashicons-no',
                    'ajax'         => [
                        'action'  => 'ultraguard_fc_cancel_scan',
                        'nonce'   => $nonce,
                        'confirm' => __( 'Cancel the running scan?', 'ultraguard-security-suite' ),
                    ],
                ] ],
            ];
        } else {
            $card['footer'] = __( 'Use the header buttons to start a scan.', 'ultraguard-security-suite' );
        }

        return $card;
    }


    /**
     * Build the recent file changes data-table card.
     */
    private function recent_changes_card( array $recent, string $nonce ): array {
        $rows = array_map( function( $row ) use ( $nonce ) {
            $id     = (int) ( $row['id'] ?? 0 );
            $status = $row['status'] ?? 'clean';
            return [
                'data-file-id' => $id,
                'file'         => esc_html( basename( $row['file_path'] ?? '' ) ),
                'status'       => [
                    'content' => ucfirst( $status ),
                    'class'   => match ( $status ) {
                        'suspicious' => 'danger',
                        'modified'   => 'warning',
                        'added'      => 'info',
                        default      => 'secondary',
                    },
                ],
                'type'         => esc_html( ucwords( str_replace( '_', ' ', $row['change_type'] ?? '—' ) ) ),
                'detected'     => esc_html( $this->format_date_time( $row['last_checked_at'] ?? '' ) ),
                'actions'      => $this->row_actions( [
                    [
                        'type'         => 'button',
                        'text'         => __( 'Approve', 'ultraguard-security-suite' ),
                        'button_style' => 'secondary',
                        'ajax'         => [
                            'action' => 'ultraguard_fc_approve_change',
                            'nonce'  => $nonce,
                            'data'   => [ 'file_id' => $id ],
                        ],
                    ],
                ] ),
            ];
        }, $recent );

        return [
            'type'    => 'card',
            'id'      => 'fc-recent-changes-card',
            'title'   => __( 'Recent File Changes', 'ultraguard-security-suite' ),
            'icon'    => 'dashicons-warning',
            'actions' => [
                $this->create_url_button(
                    __( 'View All Changes', 'ultraguard-security-suite' ),
                    admin_url( 'admin.php?page=ultraguard-security-suite-dashboard&ug_page=filechecker-changes' ),
                    'secondary',
                    'dashicons-external'
                ),
            ],
            'data'    => [
                [
                    'type'       => 'data-table',
                    'id'         => 'fc-recent-changes-table',
                    'columns'    => [
                        'file'     => [ 'title' => __( 'File',        'ultraguard-security-suite' ) ],
                        'status'   => [ 'title' => __( 'Status',      'ultraguard-security-suite' ) ],
                        'type'     => [ 'title' => __( 'Change Type', 'ultraguard-security-suite' ) ],
                        'detected' => [ 'title' => __( 'Detected',    'ultraguard-security-suite' ) ],
                        'actions'  => [ 'title' => __( 'Action',      'ultraguard-security-suite' ) ],
                    ],
                    'data'        => $rows,
                    'pagination'  => [ 'enabled' => true, 'page_size' => 5 ],
                    'empty_state' => [
                        'title'       => __( 'No file changes detected', 'ultraguard-security-suite' ),
                        'description' => __( 'All monitored files are clean.', 'ultraguard-security-suite' ),
                    ],
                ],
            ],
        ];
    }

    /**
     * Quick actions card.
     */
    private function quick_actions_card( string $nonce, bool $is_scanning ): array {
        return [
            'type'  => 'card',
            'id'    => 'fc-quick-actions-card',
            'title' => __( 'Quick Actions', 'ultraguard-security-suite' ),
            'icon'  => 'dashicons-admin-tools',
            'data'  => [
                [
                    'type'      => 'button-group',
                    'alignment' => 'center',
                    'buttons'   => [
                        [
                            'type'         => 'button',
                            'text'         => __( 'Quick Scan', 'ultraguard-security-suite' ),
                            'button_style' => 'primary',
                            'icon'         => 'dashicons-clock',
                            'disabled'     => $is_scanning,
                            'ajax'         => [ 'action' => 'ultraguard_fc_start_quick_scan', 'nonce' => $nonce ],
                        ],
                        [
                            'type'         => 'button',
                            'text'         => __( 'Full Scan', 'ultraguard-security-suite' ),
                            'button_style' => 'secondary',
                            'icon'         => 'dashicons-search',
                            'disabled'     => $is_scanning,
                            'ajax'         => [
                                'action'  => 'ultraguard_fc_start_full_scan',
                                'nonce'   => $nonce,
                                'confirm' => __( 'Start full scan?', 'ultraguard-security-suite' ),
                            ],
                        ],
                        $this->create_url_button(
                            __( 'File Monitoring', 'ultraguard-security-suite' ),
                            admin_url( 'admin.php?page=ultraguard-security-suite-dashboard&ug_page=filechecker-monitoring' ),
                            'secondary', 'dashicons-visibility'
                        ),
                        $this->create_url_button(
                            __( 'Quarantine', 'ultraguard-security-suite' ),
                            admin_url( 'admin.php?page=ultraguard-security-suite-dashboard&ug_page=filechecker-quarantine' ),
                            'secondary', 'dashicons-lock'
                        ),
                        $this->create_url_button(
                            __( 'Settings', 'ultraguard-security-suite' ),
                            admin_url( 'admin.php?page=ultraguard-security-suite-dashboard&ug_page=filechecker-settings' ),
                            'secondary', 'dashicons-admin-settings'
                        ),
                    ],
                ],
            ],
        ];
    }

    /**
     * System status sidebar card.
     */
    private function status_card( string $last_scan ): array {
        $enabled  = $this->get_setting( 'filechecker_enabled',      true );
        $schedule = $this->get_setting( 'filechecker_schedule',     'daily' );
        $core     = $this->get_setting( 'filechecker_scan_core',    true );
        $plugins  = $this->get_setting( 'filechecker_scan_plugins', true );
        $themes   = $this->get_setting( 'filechecker_scan_themes',  true );
        $malware  = $this->get_setting( 'filechecker_malware_scan', true );

        return [
            'type'  => 'card',
            'id'    => 'fc-status-card',
            'title' => __( 'System Status', 'ultraguard-security-suite' ),
            'icon'  => 'dashicons-yes-alt',
            'badge' => [
                'text'       => $enabled ? __( 'Active', 'ultraguard-security-suite' ) : __( 'Disabled', 'ultraguard-security-suite' ),
                'badge_type' => $enabled ? 'success' : 'secondary',
            ],
            'data'  => [
                [
                    'type'  => 'list',
                    'items' => [
                        [ 'icon' => 'dashicons-visibility',    'text' => __( 'Monitoring',   'ultraguard-security-suite' ), 'badge' => [ 'text' => $enabled  ? __( 'Active',    'ultraguard-security-suite' ) : __( 'Off',      'ultraguard-security-suite' ), 'badge_type' => $enabled  ? 'success' : 'secondary' ] ],
                        [ 'icon' => 'dashicons-wordpress',     'text' => __( 'WP Core',      'ultraguard-security-suite' ), 'badge' => [ 'text' => $core     ? __( 'Monitored', 'ultraguard-security-suite' ) : __( 'Skipped',  'ultraguard-security-suite' ), 'badge_type' => $core     ? 'success' : 'secondary' ] ],
                        [ 'icon' => 'dashicons-admin-plugins', 'text' => __( 'Plugins',      'ultraguard-security-suite' ), 'badge' => [ 'text' => $plugins  ? __( 'Monitored', 'ultraguard-security-suite' ) : __( 'Skipped',  'ultraguard-security-suite' ), 'badge_type' => $plugins  ? 'success' : 'secondary' ] ],
                        [ 'icon' => 'dashicons-admin-appearance','text'=> __( 'Themes',      'ultraguard-security-suite' ), 'badge' => [ 'text' => $themes   ? __( 'Monitored', 'ultraguard-security-suite' ) : __( 'Skipped',  'ultraguard-security-suite' ), 'badge_type' => $themes   ? 'success' : 'secondary' ] ],
                        [ 'icon' => 'dashicons-shield-alt',    'text' => __( 'Malware Scan', 'ultraguard-security-suite' ), 'badge' => [ 'text' => $malware  ? __( 'Enabled',   'ultraguard-security-suite' ) : __( 'Disabled', 'ultraguard-security-suite' ), 'badge_type' => $malware  ? 'success' : 'secondary' ] ],
                        [ 'icon' => 'dashicons-clock',         'text' => __( 'Schedule',     'ultraguard-security-suite' ), 'badge' => [ 'text' => ucfirst( $schedule ), 'badge_type' => 'info' ] ],
                        [ 'icon' => 'dashicons-backup',        'text' => __( 'Last Scan',    'ultraguard-security-suite' ), 'badge' => [ 'text' => $last_scan ? $this->format_time_ago( $last_scan ) : __( 'Never', 'ultraguard-security-suite' ), 'badge_type' => 'secondary' ] ],
                    ],
                ],
            ],
        ];
    }

    /**
     * Quick-navigation sidebar card.
     */
    private function navigation_card(): array {
        $pages = [
            [ 'dashicons-visibility',   __( 'File Monitoring', 'ultraguard-security-suite' ), 'filechecker-monitoring' ],
            [ 'dashicons-edit',         __( 'File Changes',    'ultraguard-security-suite' ), 'filechecker-changes'    ],
            [ 'dashicons-lock',         __( 'Quarantine',      'ultraguard-security-suite' ), 'filechecker-quarantine' ],
            [ 'dashicons-backup',       __( 'Scan History',    'ultraguard-security-suite' ), 'filechecker-history'    ],
            [ 'dashicons-admin-settings',__( 'Settings',       'ultraguard-security-suite' ), 'filechecker-settings'   ],
        ];

        $items = array_map( fn( $p ) => [
            'icon'    => $p[0],
            'text'    => $p[1],
            'actions' => [ $this->create_url_button( __( 'View', 'ultraguard-security-suite' ), admin_url( 'admin.php?page=ultraguard-security-suite-dashboard&ug_page=' . $p[2] ), 'secondary' ) ],
        ], $pages );

        return [
            'type'  => 'card',
            'id'    => 'fc-nav-card',
            'title' => __( 'Navigate', 'ultraguard-security-suite' ),
            'icon'  => 'dashicons-admin-links',
            'data'  => [ [ 'type' => 'list', 'items' => $items ] ],
        ];
    }

    /**
     * File status breakdown doughnut chart.
     *
     * @param  array $summary  Output of FileIntegrityTable::get_integrity_summary()
     */
    private function breakdown_chart( array $summary ): array {
        $clean      = (int) ( $summary['clean']      ?? 0 );
        $modified   = (int) ( $summary['modified']   ?? 0 );
        $added      = (int) ( $summary['added']      ?? 0 );
        $suspicious = (int) ( $summary['suspicious'] ?? 0 );
        $quarantine = (int) ( $summary['quarantined']?? 0 );

        return [
            'type'  => 'card',
            'id'    => 'fc-breakdown-card',
            'title' => __( 'File Breakdown', 'ultraguard-security-suite' ),
            'icon'  => 'dashicons-chart-pie',
            'data'  => [
                [
                    'type'       => 'chart',
                    'chart_type' => 'doughnut',
                    'height'     => '200px',
                    'labels'     => [
                        __( 'Clean',       'ultraguard-security-suite' ),
                        __( 'Modified',    'ultraguard-security-suite' ),
                        __( 'Added',       'ultraguard-security-suite' ),
                        __( 'Suspicious',  'ultraguard-security-suite' ),
                        __( 'Quarantine',  'ultraguard-security-suite' ),
                    ],
                    'datasets'   => [
                        [
                            'data'            => [ $clean, $modified, $added, $suspicious, $quarantine ],
                            'backgroundColor' => [ '#22c55e', '#f59e0b', '#3b82f6', '#dc2626', '#7c3aed' ],
                        ],
                    ],
                    'security_theme' => true,
                ],
            ],
        ];
    }

    private function preview_summary(): array {
        return [
            'total'       => 12436,
            'modified'    => 7,
            'added'       => 3,
            'suspicious'  => 2,
            'quarantined' => 1,
        ];
    }

    private function preview_recent_changes(): array {
        return [
            [
                'id'              => 401,
                'file_path'       => WP_CONTENT_DIR . '/plugins/checkout-helper/assets/js/cart-widget.js',
                'status'          => 'suspicious',
                'change_type'     => 'content_modified',
                'file_hash'       => '9f2a30cd5e11ab',
                'previous_hash'   => '5f0a19cd2c01dd',
                'file_size'       => 18220,
                'file_type'       => 'js',
                'is_core_file'    => 0,
                'is_approved'     => 0,
                'last_checked_at' => gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS * 5 ),
            ],
            [
                'id'              => 402,
                'file_path'       => WP_CONTENT_DIR . '/themes/storefront-child/functions.php',
                'status'          => 'modified',
                'change_type'     => 'content_modified',
                'file_hash'       => '2f0b44de7812ac',
                'previous_hash'   => '7a4d17fa66be02',
                'file_size'       => 6440,
                'file_type'       => 'php',
                'is_core_file'    => 0,
                'is_approved'     => 0,
                'last_checked_at' => gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS * 11 ),
            ],
        ];
    }
}
