21 lines
562 B
TypeScript
21 lines
562 B
TypeScript
import { z } from "zod/v4";
|
|
|
|
export const SupportValuesSchema = z
|
|
.strictObject({
|
|
resourceId: z.uuid(),
|
|
destination: z.string().trim().max(300),
|
|
requiresVpn: z.boolean(),
|
|
preferred: z.boolean(),
|
|
state: z.enum(["pending", "available", "retired"]),
|
|
notes: z.string().trim().max(2000),
|
|
})
|
|
.refine((value) => !value.preferred || value.state === "available");
|
|
|
|
export type SupportInput = z.infer<typeof SupportValuesSchema>;
|
|
|
|
export class SupportError extends Error {
|
|
constructor(public readonly code: string) {
|
|
super(code);
|
|
}
|
|
}
|