<?php

namespace UltraguardPro\modules\woo_security\schema;

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

use UltraguardPro\modules\core\AbstractModuleSchema;

class WooSecuritySchema extends AbstractModuleSchema {

    public function get_module_id(): string {
        return 'woo_security';
    }

    public function get_table_map(): array {
        return [
            'skimmer_scan_results' => \UltraguardPro\modules\woo_security\db\SkimmerScanResultsTable::class,
        ];
    }

    public function get_schemas(): array {
        $cs = $this->charset_collate();

        return [
            $this->table( 'ultraguard_skimmer_scan_results' ) =>
            "CREATE TABLE {$this->table('ultraguard_skimmer_scan_results')} (
  id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  file_path text NOT NULL,
  finding_type varchar(100) NOT NULL,
  severity varchar(20) NOT NULL DEFAULT 'medium',
  details text DEFAULT NULL,
  first_detected datetime DEFAULT NULL,
  created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY idx_finding_type (finding_type),
  KEY idx_severity (severity),
  KEY idx_created_at (created_at)
) {$cs};",
        ];
    }
}
