// Generated by bynkc — do not edit by hand.
// commons demo

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "./runtime.js";

export type Code = string & { readonly __brand: "Code" };

export const Code = {
  of(value: string): Result<Code, ValidationError> {
    if (!(value.length >= 3)) {
      return Err({ field: "Code", message: "length must be at least 3", value });
    }
    return Ok(value as Code);
  },
  unsafe(value: string): Code {
    return value as Code;
  },
};

export function firstChar(c: Code): boolean {
  return true;
}

export function check(s: string): boolean {
  const __r0 = s;
  return (__r0.length >= 3) && ((() => { const s = __r0 as Code; return firstChar(s); })());
}

