<?php
/**
 * Uninstall Plugin
 *
 * Removes database tables and options when the plugin is deleted.
 *
 * @package Maca_Menu_List
 */

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

require_once dirname(__FILE__) . '/includes/maca-api.php';
maca_restu_api_on_uninstall();

if (defined('MACA_RESTU_API_FLUSH_CRON_HOOK')) {
    wp_clear_scheduled_hook(MACA_RESTU_API_FLUSH_CRON_HOOK);
}

require_once dirname(__FILE__) . '/includes/db.php';

maca_menulist_db_drop_tables();

$maca_menulist_options = array(
    'maca_menulist_display_mode',
    'maca_menulist_button_layout',
    'maca_menulist_content_mode',
    'maca_menulist_public_keep_files_during_migration',
    'maca_menulist_price_currency',
    'maca_menulist_dish_category_filter',
    'maca_menulist_dish_category_nav',
    'maca_menulist_dish_clickable_images',
    'maca_menulist_campaign_exclusive_mode',
    'maca_menulist_dish_guest_ratings',
    'maca_menulist_table_order',
    'maca_menulist_table_order_line_notes',
    'maca_menulist_table_order_order_note',
    'maca_menulist_table_order_show_prices',
    'maca_menulist_table_order_guest_status',
    'maca_menulist_table_order_delivery_mode',
    'maca_menulist_table_order_staff_pin',
    'maca_menulist_waiter_order_slug',
    'maca_menulist_kitchen_order_slug',
    'maca_menulist_attendance_enabled',
    'maca_menulist_attendance_slug',
    'maca_menulist_pdf_display_mode',
    'maca_menulist_show_menu_title',
    'maca_menulist_website_menu_page_title',
    'maca_menulist_website_menu_page_title_en',
    'maca_menulist_qr_menu_page_title',
    'maca_menulist_qr_menu_page_title_en',
    'maca_menulist_show_schedule_notes',
    'maca_menulist_qr_slug',
    'maca_menulist_flush_rewrite',
    'maca_menulist_qr_category',
    'maca_menulist_qr_title',
    'maca_menulist_qr_subtitle',
    'maca_menulist_qr_logo',
    'maca_menulist_qr_menu_show_logo',
    'maca_menulist_qr_print_show_logo',
    'maca_menulist_qr_display_mode',
    'maca_menulist_qr_category_nav',
    'maca_menulist_qr_paper_size',
    'maca_menulist_qr_page',
    'maca_menulist_db_version',
    'maca_menulist_rewrite_version',
    'maca_menulist_https_migrated',
    'maca_menulist_credit_option_removed',
    'maca_menulist_flush_flag_cleared',
    'maca_menulist_pro_license',
    'maca_menulist_backup_daily_enabled',
    'maca_menulist_backup_retention_days',
    'maca_menulist_backup_daily_time',
    'maca_menulist_backup_last_run',
    'maca_menulist_backup_last_file',
    'maca_menulist_backup_last_reason',
    'maca_menulist_menu_footer_enabled',
    'maca_menulist_menu_footer_restaurant_name',
    'maca_menulist_menu_footer_address',
    'maca_menulist_menu_footer_phone',
    'maca_menulist_menu_footer_email',
    'maca_menulist_menu_footer_website',
    'maca_menulist_menu_footer_vat_number',
    'maca_menulist_vat_rate_dine_in',
    'maca_menulist_vat_rate_takeaway',
    'maca_menulist_vat_rate_alcohol',
    'maca_menulist_vat_rate_dine_in_upcoming',
    'maca_menulist_vat_rate_takeaway_upcoming',
    'maca_menulist_vat_rate_alcohol_upcoming',
    'maca_menulist_vat_rate_dine_in_upcoming_date',
    'maca_menulist_vat_rate_takeaway_upcoming_date',
    'maca_menulist_vat_rate_alcohol_upcoming_date',
    'maca_menulist_service_mode',
    'maca_menulist_offering_mode',
    'maca_menulist_offering_mode_migrated',
    'maca_menulist_takeaway_slug',
    'maca_menulist_takeaway_page_title',
    'maca_menulist_menu_footer_allergy_text',
    'maca_menulist_menu_footer_price_text',
    'maca_menulist_menu_footer_serves_alcohol',
    'maca_menulist_menu_footer_age_text',
    'maca_menulist_menu_print_title',
    'maca_menulist_dish_menu_theme',
    'maca_menulist_dish_menu_layout',
    'maca_menulist_menu_print_theme',
    'maca_menulist_menu_print_layout',
    'maca_menulist_menu_print_logo',
    'maca_menulist_menu_print_paper_size',
    'maca_menulist_dual_language_menu',
    'maca_menulist_menu_language_switcher',
    'maca_menulist_local_language',
    'maca_menulist_legal_acceptance',
    'maca_menulist_onboarding',
    'maca_menulist_onboarding_enabled',
    'maca_menulist_orders_purge_enabled',
    'maca_menulist_orders_purge_days',
    'maca_menulist_orders_purge_daily_time',
    'maca_menulist_orders_purge_last_run',
    'maca_menulist_orders_purge_last_count',
    'maca_menulist_table_booking',
    'maca_menulist_table_booking_slot_duration',
    'maca_menulist_table_booking_hold_minutes',
    'maca_menulist_table_booking_arrival_notice',
    'maca_menulist_table_booking_arrival_notice_en',
    'maca_menulist_table_booking_advance_days',
    'maca_menulist_table_booking_assignment_mode',
    'maca_menulist_table_booking_hours',
    'maca_menulist_table_booking_guest_cancel',
    'maca_menulist_table_booking_cancel_slug',
    'maca_menulist_table_booking_captcha_provider',
    'maca_menulist_table_booking_captcha_site_key',
    'maca_menulist_table_booking_captcha_secret_key',
    'maca_menulist_table_booking_captcha_v3_score',
    'maca_menulist_table_booking_button_text',
    'maca_menulist_table_booking_button_text_en',
    'maca_menulist_table_booking_title_text',
    'maca_menulist_table_booking_title_text_en',
    'maca_menulist_info_hub_enabled',
    'maca_menulist_info_hub_meta_app_id',
    'maca_menulist_info_hub_meta_app_secret',
    'maca_menulist_info_hub_meta_page_id',
    'maca_menulist_info_hub_meta_page_name',
    'maca_menulist_info_hub_meta_page_token',
    'maca_menulist_info_hub_meta_user_token',
    'maca_menulist_info_hub_meta_token_expires',
    'maca_menulist_info_hub_meta_ig_user_id',
    'maca_menulist_info_hub_meta_ig_username',
    'maca_menulist_info_hub_meta_test_image_url',
    'maca_restu_plugin_version',
    'maca_restu_pending_telemetry',
    'maca_restu_api_last_error',
);

foreach ($maca_menulist_options as $maca_menulist_option) {
    delete_option($maca_menulist_option);
}

wp_cache_flush();

