<?php
/**
 * File Path: includes/migrations/class-mbs-migration-4-26.php
 *
 * Migration 4.26 -- Session 182: ARC Multi-URL per Reviewer
 *
 * Adds review_urls TEXT NULL DEFAULT NULL to mbs_arc_recipients via dbDelta.
 * Existing rows default to NULL (legacy single URL remains in review_url).
 *
 * Idempotency: dbDelta only adds the column if it is absent from the live table.
 *
 * @package MyBookShowroom
 * @since   1.4.0
 */

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

/**
 * Migration 4.26: Add review_urls to mbs_arc_recipients.
 *
 * @implements MBS_Migration
 */
class MBS_Migration_4_26 implements MBS_Migration { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- mbs_/MBS_ prefix is correct; scanner not configured with plugin prefix

	/**
	 * Return the migration version string.
	 *
	 * @return string
	 * @since 1.4.0
	 */
	public function version(): string {
		return '4.26';
	}

	/**
	 * Run the migration.
	 *
	 * Calls dbDelta() against the updated MBS_DB_Schema::arc_recipients() DDL.
	 * dbDelta adds review_urls TEXT NULL to the live table; existing rows receive
	 * NULL automatically. The legacy review_url column is left intact.
	 *
	 * @return void
	 * @since 1.4.0
	 */
	public function up(): void {
		global $wpdb;
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		$table           = $wpdb->prefix . 'mbs_arc_recipients';
		$charset_collate = $wpdb->get_charset_collate();
		dbDelta( MBS_DB_Schema::arc_recipients( $table, $charset_collate ) );
	}
}
