<?php
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

global $wpdb;

// phpcs:disable WordPress.DB.DirectDatabaseQuery -- uninstall removes the plugin's own tables and transients; schema change here is the point.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}arcai_chunks" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}arcai_usage" );

delete_option( 'arcai_settings' );
delete_option( 'arcai_db_version' );
delete_option( 'arcai_index_state' );
delete_option( 'arcai_index_generation' );

$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '\_transient\_arcai\_%' OR option_name LIKE '\_transient\_timeout\_arcai\_%'" );
// phpcs:enable WordPress.DB.DirectDatabaseQuery
