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

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

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

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

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

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

