import { LooseArray } from "../../../util/schema-utils/index.js";
import { MaybeTimestamp } from "../../../util/timestamp.js";
import { z } from "zod/v3";
//#region lib/modules/datasource/terraform-provider/schema.ts
const ProviderAttributes = z.object({ source: z.string().optional() });
const ProviderVersion = z.object({
	type: z.literal("provider-versions"),
	attributes: z.object({
		version: z.string(),
		"published-at": MaybeTimestamp
	})
}).transform((resource) => ({
	version: resource.attributes.version,
	releaseTimestamp: resource.attributes["published-at"]
}));
const TerraformProviderV2Response = z.object({
	data: z.object({ attributes: ProviderAttributes }),
	included: LooseArray(ProviderVersion).catch([])
}).transform((response) => ({
	sourceUrl: response.data.attributes.source,
	releases: response.included
}));
//#endregion
export { TerraformProviderV2Response };

//# sourceMappingURL=schema.js.map