"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComposerConfig = exports.ComposerLock = void 0;
const zod_1 = require("zod");
const ComposerLockPackage = zod_1.z.object({
    name: zod_1.z.string(),
    version: zod_1.z.string(),
});
exports.ComposerLock = zod_1.z.object({
    'plugin-api-version': zod_1.z.string().optional(),
    packages: zod_1.z.array(ComposerLockPackage).optional(),
    'packages-dev': zod_1.z.array(ComposerLockPackage).optional(),
});
const ComposerRepository = zod_1.z.object({
    name: zod_1.z.string().optional(),
    type: zod_1.z.union([
        zod_1.z.literal('composer'),
        zod_1.z.literal('git'),
        zod_1.z.literal('package'),
        zod_1.z.literal('path'),
        zod_1.z.literal('vcs'),
    ]),
    packagist: zod_1.z.boolean().optional(),
    'packagist.org': zod_1.z.boolean().optional(),
    url: zod_1.z.string().url(),
});
const ComposerRepositories = zod_1.z.union([
    zod_1.z.record(zod_1.z.string(), zod_1.z.union([ComposerRepository, zod_1.z.boolean()])),
    zod_1.z.array(ComposerRepository),
]);
exports.ComposerConfig = zod_1.z.object({
    type: zod_1.z.string().optional(),
    /**
     * Setting a fixed PHP version (e.g. {"php": "7.0.3"}) will let you fake the
     * platform version so that you can emulate a production env or define your
     * target platform in the config.
     * See https://getcomposer.org/doc/06-config.md#platform
     */
    config: zod_1.z
        .object({ platform: zod_1.z.object({ php: zod_1.z.string().optional() }).optional() })
        .optional(),
    /**
     * A repositories field can be an array of Repo objects or an object of repoName: Repo
     * Also it can be a boolean (usually false) to disable packagist.
     * (Yes this can be confusing, as it is also not properly documented in the composer docs)
     * See https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org
     */
    repositories: ComposerRepositories.optional(),
    require: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
    'require-dev': zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
});
//# sourceMappingURL=schema.js.map