/**
 * createDriveLiteracyPreset — Drive-specific literacy preset (W0210).
 *
 * Plugs a `GoogleDriveDocFetcher` into the literacy mode base. The
 * `source` parameter is narrowed by `PresetFactory<"google-drive">` in
 * `PRESET_FACTORY_BY_SOURCE`, so no in-preset type-asserting is needed.
 *
 * Service-account auth is loaded eagerly at preset-construction time —
 * missing credentials fail fast here rather than at first fetch.
 */
import { drive } from "@googleapis/drive";
import { loadGoogleAuth } from "./auth.js";
import { GoogleDriveDocFetcher } from "./doc-fetcher.js";
export function createDriveLiteracyPreset({ rootDir, source, }) {
    // Eagerly resolve credentials so missing-creds is a preset-construction
    // error, not a runtime failure on the first fetch.
    const auth = loadGoogleAuth();
    const client = drive({ version: "v3", auth });
    return {
        name: "drive-literacy",
        manifest: {
            name: "drive-literacy",
            version: "1.0.0",
            description: "Documentation literacy evaluation backed by Google Drive — " +
                "fetches markdown / Google Docs from a shared folder via " +
                "service-account auth.",
            pluginApiVersion: 1,
        },
        mode: "literacy",
        // The Drive preset deliberately ships no fixtureResolvers / featureDefs.
        // Those surfaces exist for Sanity-specific content-lake semantics and
        // don't have a Drive analogue today.
        docFetcher: () => new GoogleDriveDocFetcher(source, client, { rootDir }),
    };
}
