// 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.

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";

export type RepresentFn<D> = (data: D, style?: StyleVariant) => string;

// deno-lint-ignore no-explicit-any
export interface Type<K extends KindType, D = any> {
  tag: string;
  kind: K;
  predicate?: (data: unknown) => data is D;
  represent?: RepresentFn<D> | Record<string, RepresentFn<D>>;
  defaultStyle?: StyleVariant;
  // deno-lint-ignore no-explicit-any
  resolve: (data: any) => boolean;
  // deno-lint-ignore no-explicit-any
  construct: (data: any) => D;
}

// denoCacheMetadata={"headers":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","x-jsr-cache-status":"hit","x-goog-storage-class":"STANDARD","accept-ranges":"bytes","x-guploader-uploadid":"AAwnv3JcH9ZlMKKq2Go4C4qpCVwUMnX-P7uuGFWwy90vPIQ2dwg_C4NHWnwAcmQ3xfw6HNSJ","age":"518","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","x-robots-tag":"noindex","x-content-type-options":"nosniff","x-goog-metageneration":"1","date":"Tue, 30 Sep 2025 15:38:30 GMT","x-goog-stored-content-length":"1023","expires":"Wed, 30 Sep 2026 15:38:30 GMT","content-type":"text/typescript","x-jsr-cache-id":"SFO-1d5601d9","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","etag":"\"78fabdedec9773255c042dc408071b31\"","x-goog-hash":"crc32c=F7fBAA==,md5=ePq97eyXcyVcBC3ECAcbMQ==","x-goog-stored-content-encoding":"identity","server":"UploadServer","via":"1.1 google","last-modified":"Tue, 22 Jul 2025 13:14:59 GMT","access-control-allow-origin":"*","content-length":"1023","x-goog-generation":"1753190099114348"},"url":"https://jsr.io/@std/yaml/1.0.9/_type.ts","time":1759247228}