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

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

export type Root = number & { readonly __brand: "Root" };

export const Root = {
  of(value: number): Result<Root, ValidationError> {
    if (!Number.isInteger(value)) {
      return Err({ field: "Root", message: "must be an integer", value });
    }
    if (!(value > 0)) {
      return Err({ field: "Root", message: "must be positive", value });
    }
    return Ok(value as Root);
  },
  unsafe(value: number): Root {
    return value as Root;
  },
};

