// Ported from js-yaml v3.13.1:
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.

/**
 * The kind of YAML node.
 */
export type KindType = "sequence" | "scalar" | "mapping";
/**
 * The style variation for `styles` option of {@linkcode stringify}
 */
export type StyleVariant =
  | "lowercase"
  | "uppercase"
  | "camelcase"
  | "decimal"
  | "binary"
  | "octal"
  | "hexadecimal";

/**
 * Function to convert data to a string for YAML serialization.
 */
export type RepresentFn<D> = (data: D, style?: StyleVariant) => string;

/**
 * A type definition for a YAML node.
 */
// deno-lint-ignore no-explicit-any
export interface Type<K extends KindType, D = any> {
  /** Tag to identify the type */
  tag: string;
  /** Kind of type */
  kind: K;
  /** Cast the type. Used to stringify */
  predicate?: (data: unknown) => data is D;
  /** Function to represent data. Used to stringify */
  represent?: RepresentFn<D> | Record<string, RepresentFn<D>>;
  /** Default style for the type. Used to stringify */
  defaultStyle?: StyleVariant;
  /** Function to test whether data can be resolved by this type. Used to parse */
  // deno-lint-ignore no-explicit-any
  resolve: (data: any) => boolean;
  /** Function to construct data from string. Used to parse */
  // deno-lint-ignore no-explicit-any
  construct: (data: any) => D;
}

// denoCacheMetadata={"headers":{"content-length":"1529","server":"UploadServer","x-goog-stored-content-encoding":"identity","x-goog-storage-class":"STANDARD","age":"2188","accept-ranges":"bytes","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cache-control":"public, max-age=31536000, immutable","expires":"Sat, 16 Jan 2027 21:13:26 GMT","x-guploader-uploadid":"AJRbA5WFFEUcE3-3Gxyv8QYW1pS4JJib1e2sELJjfWWrDzhKmmV-vDGVyfcm4pDoqOM1UYfPptXsZs8fqUkcoQ","last-modified":"Tue, 07 Oct 2025 07:31:52 GMT","x-goog-hash":"crc32c=vcJEvQ==,md5=+wa56YcJlXzfC79A+fuXbA==","x-goog-metageneration":"1","x-robots-tag":"noindex","access-control-allow-origin":"*","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","etag":"\"fb06b9e98709957cdf0bbf40f9fb976c\"","content-type":"text/typescript","x-content-type-options":"nosniff","via":"1.1 google","date":"Fri, 16 Jan 2026 21:13:26 GMT","x-jsr-cache-id":"DFW","x-jsr-cache-status":"hit","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","x-goog-generation":"1759822312743494","x-goog-stored-content-length":"1529"},"url":"https://jsr.io/@std/yaml/1.0.10/_type.ts","time":1768600194}