"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DotnetRuntimeReleases = exports.DotnetSdkReleases = exports.ReleasesIndex = void 0;
const zod_1 = require("zod");
const schema_utils_1 = require("../../../util/schema-utils");
exports.ReleasesIndex = zod_1.z
    .object({
    'releases-index': (0, schema_utils_1.looseArray)(zod_1.z
        .object({
        'releases.json': zod_1.z.string(),
    })
        .transform(({ 'releases.json': releasesUrl }) => releasesUrl)),
})
    .transform(({ 'releases-index': releasesIndex }) => releasesIndex);
const ReleaseBase = zod_1.z.object({
    'release-date': zod_1.z.string(),
    'release-notes': zod_1.z.string(),
});
const ReleaseDetails = zod_1.z.object({
    version: zod_1.z.string(),
});
exports.DotnetSdkReleases = zod_1.z
    .object({
    releases: (0, schema_utils_1.looseArray)(ReleaseBase.extend({
        sdk: ReleaseDetails,
    })),
})
    .transform(({ releases }) => releases.map(({ sdk: { version }, 'release-date': releaseTimestamp, 'release-notes': changelogUrl, }) => ({ version, releaseTimestamp, changelogUrl })));
exports.DotnetRuntimeReleases = zod_1.z
    .object({
    releases: (0, schema_utils_1.looseArray)(ReleaseBase.extend({
        runtime: ReleaseDetails,
    })),
})
    .transform(({ releases }) => releases.map(({ runtime: { version }, 'release-date': releaseTimestamp, 'release-notes': changelogUrl, }) => ({ version, releaseTimestamp, changelogUrl })));
//# sourceMappingURL=schema.js.map