<?php
/**
 * Journey Events Schema Class.
 *
 * @package     EDD\Pro\CartRecovery\Database\Schemas
 * @copyright   Copyright (c) 2026 Sandhills Development, LLC
 * @license     https://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       3.6.5
 */

namespace EDD\Pro\CartRecovery\Database\Schemas;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

use EDD\Database\Schema;

/**
 * Defines the schema for the journey events table.
 */
final class JourneyEvents extends Schema {

	/**
	 * Array of database column definitions.
	 *
	 * @var array
	 */
	public $columns = array(
		array(
			'name'     => 'id',
			'type'     => 'bigint',
			'length'   => 20,
			'unsigned' => true,
			'extra'    => 'auto_increment',
			'primary'  => true,
			'sortable' => true,
		),
		array(
			'name'       => 'cart_id',
			'type'       => 'bigint',
			'length'     => 20,
			'unsigned'   => true,
			'allow_null' => false,
			'index'      => true,
			'sortable'   => true,
		),
		array(
			'name'       => 'email_id',
			'type'       => 'bigint',
			'length'     => 20,
			'unsigned'   => true,
			'default'    => null,
			'allow_null' => true,
			'index'      => true,
		),
		array(
			'name'       => 'event_type',
			'type'       => 'varchar',
			'length'     => 50,
			'allow_null' => false,
			'index'      => true,
			'sortable'   => true,
		),
		array(
			'name'       => 'event_data',
			'type'       => 'longtext',
			'default'    => null,
			'allow_null' => true,
		),
		array(
			'name'       => 'user_agent',
			'type'       => 'varchar',
			'length'     => 255,
			'default'    => null,
			'allow_null' => true,
		),
		array(
			'name'       => 'ip_address',
			'type'       => 'varchar',
			'length'     => 45,
			'default'    => null,
			'allow_null' => true,
		),
		array(
			'name'       => 'date_created',
			'type'       => 'datetime',
			'default'    => null,
			'allow_null' => false,
			'created'    => true,
			'date_query' => true,
			'index'      => true,
		),
	);
}
