<?php
namespace nur\sery\wip\schema\types;

use nur\sery\wip\schema\Result;
use nur\sery\wip\schema\Schema;

class tkey extends _tsimple {
  static function ensure_key(&$key): void {
    if (!is_string($key) && !is_int($key)) $key = strval($key);
  }

  static function ensure_nkey(&$key): void {
    if ($key !== null) self::ensure_key($key);
  }

  function isValid($value, ?bool &$normalized=null): bool {
    $normalized = is_string($value) || is_int($value);
    return is_scalar($value);
  }

  function verifix(&$value, Result &$result, Schema $schema): bool {
  }

  function format($value, $format=null): string {
  }
}
