/// <reference path="../.astro/types.d.ts" />

// TypeScript type definitions for Cloudflare bindings
// Update this file with your actual binding names

interface Env {
  // Environment Variables (from wrangler.jsonc vars section)
  ENVIRONMENT: string;
  PUBLIC_SITE_URL: string;
  API_URL?: string;

  // Cloudflare Bindings (configure in wrangler.jsonc)
  CACHE?: KVNamespace;
  DB?: D1Database;
  STORAGE?: R2Bucket;

  // Add your custom bindings here
  // MY_KV_NAMESPACE: KVNamespace;
  // MY_D1_DATABASE: D1Database;
  // MY_R2_BUCKET: R2Bucket;

  // Sensitive secrets (use wrangler secret put)
  API_KEY?: string;
  DATABASE_URL?: string;
}

// Runtime type for Astro
type Runtime = import('@astrojs/cloudflare').Runtime<Env>;

// Extend Astro's interfaces
declare namespace App {
  interface Locals extends Runtime {}
}

declare namespace Astro {
  interface Locals extends Runtime {}
}

// For API endpoints
export type { Env, Runtime };
