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

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

export type Outcome =
    { readonly tag: "Won"; readonly prize: number }
  | { readonly tag: "Lost"; readonly reason: string }
  | { readonly tag: "Draw" };

export const Outcome = {
  Won: (prize: number): Outcome => ({ tag: "Won", prize }),
  Lost: (reason: string): Outcome => ({ tag: "Lost", reason }),
  Draw: { tag: "Draw" } as Outcome,
};

export function describe(o: Outcome): string {
  switch (o.tag) {
    case "Won": {
      const p = o.prize;
      return "won";
    }
    case "Lost": {
      const r = o.reason;
      return r;
    }
    case "Draw": {
      return "draw";
    }
  }
  throw new Error("non-exhaustive match");
}

