<?php
/**
 * Transaction Session Data Class
 *
 * This class is used to store and manage transaction session data including
 * email and phone transaction IDs for OTP verification sessions.
 *
 * @package miniorange-sms-order-notification-otp-verification/objects
 */

namespace WCSMSOTP\Objects;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Transaction Session Data Class
 *
 * This class is used to store and manage transaction session data including
 * email and phone transaction IDs for OTP verification sessions.
 */
if ( ! class_exists( 'TransactionSessionData' ) ) {
	/**
	 * Transaction Session Data Class
	 *
	 * This class is used to store and manage transaction session data including
	 * email and phone transaction IDs for OTP verification sessions.
	 */
	class TransactionSessionData {

		/**
		 * Email transaction ID
		 *
		 * @var string
		 */
		private $email_transaction_id;

		/**
		 * Phone transaction ID
		 *
		 * @var string
		 */
		private $phone_transaction_id;

		/**
		 * Get the email transaction ID.
		 *
		 * @return string Email transaction ID.
		 */
		public function get_email_transaction_id() {
			return $this->email_transaction_id;
		}

		/**
		 * Set the email transaction ID.
		 *
		 * @param string $email_transaction_id Email transaction ID.
		 * @return void
		 */
		public function set_email_transaction_id( $email_transaction_id ) {
			if ( ! is_string( $email_transaction_id ) ) {
				$email_transaction_id = '';
			}
			$this->email_transaction_id = sanitize_text_field( $email_transaction_id );
		}

		/**
		 * Get the phone transaction ID.
		 *
		 * @return string Phone transaction ID.
		 */
		public function get_phone_transaction_id() {
			return $this->phone_transaction_id;
		}

		/**
		 * Set the phone transaction ID.
		 *
		 * @param string $phone_transaction_id Phone transaction ID.
		 * @return void
		 */
		public function set_phone_transaction_id( $phone_transaction_id ) {
			if ( ! is_string( $phone_transaction_id ) ) {
				$phone_transaction_id = '';
			}
			$this->phone_transaction_id = sanitize_text_field( $phone_transaction_id );
		}
	}
}
