metis-desk/modules/assets/src/api/domain/support-values.ts

21 lines
562 B
TypeScript
Raw Normal View History

2026-10-07 08:16:39 +00:00
import { z } from "zod/v4";
2026-10-10 10:01:58 +00:00
2026-10-07 08:16:39 +00:00
export const SupportValuesSchema = z
.strictObject({
resourceId: z.uuid(),
2026-10-07 08:16:39 +00:00
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");
2026-10-10 10:01:58 +00:00
2026-10-07 08:16:39 +00:00
export type SupportInput = z.infer<typeof SupportValuesSchema>;
2026-10-10 10:01:58 +00:00
2026-10-07 08:16:39 +00:00
export class SupportError extends Error {
constructor(public readonly code: string) {
super(code);
}
}