import { z } from "zod";
const RESERVED_NAMES = new Set([
"api",
"assets",
"auth",
"dashboard",
"explore",
"login",
"logout",
"new",
"notifications",
"orgs",
"search",
"settings",
"signup",
"static",
"favicon.ico",
]);
export const accountName = z
.string()
.trim()
.min(1)
.max(39)
.regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/, "Use letters, numbers and single hyphens")
.refine((name) => !RESERVED_NAMES.has(name.toLowerCase()), "That name is reserved");
export const repoName = z
.string()
.trim()
.min(1)
.max(100)
.regex(/^[A-Za-z0-9._-]+$/, "Use letters, numbers, '.', '-' and '_'")
.refine((name) => !name.endsWith(".git") && name !== "." && name !== "..", "Invalid repository name");
export const repoRef = z.object({ owner: z.string().min(1), repo: z.string().min(1) });
export const password = z.string().min(8, "Use at least 8 characters").max(200);