import "server-only";

import { loadEnv } from "@/lib/env";

const env = loadEnv();

export const projectId: string | undefined = env.sanityProjectId;
export const dataset: string = env.sanityDataset;
export const apiVersion: string = env.sanityApiVersion;
export const readToken: string | undefined = env.sanityApiReadToken;
export const webhookSecret: string | undefined = env.sanityWebhookSecret;
export const previewSecret: string | undefined = env.sanityPreviewSecret;

/**
 * True only when a real Sanity project id is present in the environment.
 * All editorial routes should gate real fetches on this flag and fall back
 * to "coming soon" empty states otherwise.
 */
export const isConfigured: boolean = typeof projectId === "string" && projectId.length > 0;
