// Generated by bynkc — do not edit by hand.
// context commerce.payment

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

export type AuthId = string & { readonly __brand: "commerce.payment.AuthId" };

export const AuthId = {
  of(value: string): Result<AuthId, ValidationError> {
    if (!new RegExp("^" + "AUTH-[0-9]+" + "$").test(value)) {
      return Err({ field: "AuthId", message: "must match /AUTH-[0-9]+/", value });
    }
    return Ok(value as AuthId);
  },
  unsafe(value: string): AuthId {
    return value as AuthId;
  },
};

export type PaymentError =
    { readonly tag: "Declined" }
  | { readonly tag: "InsufficientFunds" };

export const PaymentError = {
  Declined: { tag: "Declined" } as PaymentError,
  InsufficientFunds: { tag: "InsufficientFunds" } as PaymentError,
};

