import { EmailAddress } from "../../../util/schema-utils/index.js";
import { z } from "zod/v3";
//#region lib/modules/platform/scm-manager/schema.ts
const User = z.object({
	mail: EmailAddress,
	displayName: z.string(),
	name: z.string()
});
const DefaultBranchSchema = z.object({ defaultBranch: z.string() });
const LinkSchema = z.object({
	href: z.string(),
	name: z.string().optional().nullable(),
	templated: z.boolean().optional().nullable()
});
const LinksSchema = z.record(z.string(), z.union([LinkSchema, z.array(LinkSchema)]));
const PrStateSchema = z.enum([
	"DRAFT",
	"OPEN",
	"REJECTED",
	"MERGED"
]);
const PrMergeMethodSchema = z.enum([
	"MERGE_COMMIT",
	"REBASE",
	"FAST_FORWARD_IF_POSSIBLE",
	"FAST_FORWARD_ONLY",
	"SQUASH"
]);
const PullRequestSchema = z.object({
	id: z.string(),
	author: z.object({
		mail: z.string().optional().nullable(),
		displayName: z.string(),
		id: z.string()
	}).optional().nullable(),
	reviser: z.object({
		id: z.string().optional().nullable(),
		displayName: z.string().optional().nullable()
	}).optional().nullable(),
	closeDate: z.string().optional().nullable(),
	source: z.string(),
	target: z.string(),
	title: z.string(),
	description: z.string().optional().nullable(),
	creationDate: z.string(),
	lastModified: z.string().optional().nullable(),
	status: PrStateSchema,
	reviewer: z.array(z.object({
		id: z.string(),
		displayName: z.string(),
		mail: z.string().optional().nullable(),
		approved: z.boolean()
	})).optional().nullable(),
	labels: z.string().array(),
	tasks: z.object({
		todo: z.number(),
		done: z.number()
	}),
	_links: LinksSchema,
	_embedded: z.object({ defaultConfig: z.object({
		mergeStrategy: PrMergeMethodSchema,
		deleteBranchOnMerge: z.boolean()
	}) })
});
const RepoTypeSchema = z.enum([
	"git",
	"svn",
	"hg"
]);
const RepoSchema = z.object({
	contact: z.string().optional().nullable(),
	creationDate: z.string().optional().nullable(),
	description: z.string().optional().nullable(),
	lastModified: z.string().optional().nullable(),
	namespace: z.string(),
	name: z.string(),
	type: RepoTypeSchema,
	archived: z.boolean(),
	exporting: z.boolean(),
	healthCheckRunning: z.boolean(),
	_links: LinksSchema
});
const PagedSchema = z.object({
	page: z.number(),
	pageTotal: z.number()
});
const PagedPullRequestSchema = PagedSchema.extend({ _embedded: z.object({ pullRequests: z.array(PullRequestSchema) }) });
const PagedRepoSchema = PagedSchema.extend({ _embedded: z.object({ repositories: z.array(RepoSchema) }) });
//#endregion
export { DefaultBranchSchema, PagedPullRequestSchema, PagedRepoSchema, PullRequestSchema, RepoSchema, User };

//# sourceMappingURL=schema.js.map