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

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

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

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

