let counter = 0;

const next = (): string => '00000000-0000-0000-0000-' + String(++counter).padStart(12, '0');

export const v1 = next;
export const v3 = next;
export const v4 = next;
export const v5 = next;
export const v6 = next;
export const v7 = next;
export const NIL = '00000000-0000-0000-0000-000000000000';
export const validate = (value: string): boolean => /^[0-9a-f-]{36}$/i.test(value);
export const version = (): number => 4;
export const parse = (value: string): Uint8Array => new Uint8Array(16);
export const stringify = (): string => next();

export default { v1, v3, v4, v5, v6, v7, NIL, validate, version, parse, stringify };
