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

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

import { Money as __CommonsMoney } from "./money.js";

import * as commerce_payment from "./payment.js";

export type Money = __CommonsMoney & { readonly __ctxBrand: "commerce.orders" };

export const placeOrder = {
  async call(total: Money, deps: { surface: { payment: ReturnType<typeof commerce_payment.makeSurface> } }): Promise<Result<number, number>> {
    const __r0 = await deps.surface.payment.authorise((total as unknown as commerce_payment.Money));
    return Ok(0);
  },
};

export interface CommerceOrdersDeps {
  readonly surface: { payment: ReturnType<typeof commerce_payment.makeSurface> };
}

export function makeSurface(deps: CommerceOrdersDeps) {
  return {
    async placeOrder(total: Money): Promise<Result<number, number>> {
      return placeOrder.call(total, deps);
    },
  };
}

