import type { CompanionDatabase } from "./database.js";
import type { JobRunner } from "./jobs.js";

declare module "fastify" {
  interface FastifyRequest {
    authUser: { id: number; username: string; role: "admin" } | null;
  }

  interface FastifyInstance {
    database: CompanionDatabase;
    jobRunner: JobRunner;
  }
}

export type Availability<T> =
  | { available: true; value: T }
  | { available: false; reason: string };
