<?php

	namespace VLW\Helpers;

	class UUID {
		public const LENGTH = 36;
		
		public static function nil(): string {
			return "00000000-0000-0000-0000-000000000000";
		}

		public static function max(): string {
			return "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
		}

		public static function v4(): string {
			return sprintf("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
				mt_rand(0, 0xffff), mt_rand(0, 0xffff),
				mt_rand(0, 0xffff),
				mt_rand(0, 0x0fff) | 0x4000,
				mt_rand(0, 0x3fff) | 0x8000,
				mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
			);
		}
	}
