<?php
/**
 * A class of utilities for dealing with unique strings.
 *
 * @since 3.0.0
 */

declare(strict_types=1);
namespace FeData\FastEvents\Utilities;

/**
 * A class of utilities for dealing with unique strings.
 */
class UniqIds {

	/**
	 * Generate unique id.
	 * Used for qrcodes, scan-keys, keys for apps (FE Admin and FE Payments)
	 *
	 * @since 1.0
	 * @since 2.5.0 Simplified the function.
	 *
	 * @return string
	 */
	public static function uniq_id(): string {
		return wp_generate_password( 16, false );
	}


	/**
	 * Generate unique order id.
	 *
	 * @since 1.0
	 * @since 2.5.0 Simplified the function.
	 *
	 * @return string
	 */
	public static function uniq_order_id(): string {
		return wp_generate_password( 40, false );
	}


	/**
	 * Generate unique int between 100 and 1000000000.
	 *
	 * @since 1.0
	 * @since 2.5.0 Simplified the function.
	 *
	 * @return int
	 */
	public static function uniq_int(): int {
		return wp_rand( 100, 1000000000 );
	}


	/**
	 * Generate unique id for input and ticket fields.
	 *
	 * @since 1.0
	 * @since 2.5.0 Simplified the function.
	 *
	 * @return string
	 */
	public static function uniq_field(): string {
		return sprintf( '%04x', wp_rand( 0, 0xffff ) );
	}
}
