// Generated by bynkc — do not edit by hand.
// context jobs

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

import { traverse } from "../bynk/list.js";

export interface Clock {
  now(): Promise<number>;
}

export const ClockToken: unique symbol = Symbol("Clock");

export class FixedClock implements Clock {
  async now(): Promise<number> {
    return 42;
  }
}

export const FixedClockProvider = { token: ClockToken, factory: () => new FixedClock() };

export const stamps = {
  async call(names: readonly string[], deps: { Clock: Clock }): Promise<Result<readonly number[], void>> {
    const stamped = await traverse(names, async (name) => deps.Clock.now());
    return Ok(stamped);
  },
};

export interface JobsDeps {
  readonly Clock: Clock;
}

export function makeSurface(deps: JobsDeps) {
  return {
    async stamps(names: readonly string[]): Promise<Result<readonly number[], void>> {
      return stamps.call(names, deps);
    },
  };
}

