// Generated by bynkc — do not edit by hand.
// commons opacity.basic

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

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

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

