// Copyright 2026 Synnax Labs, Inc. // // Use of this software is governed by the Business Source License included in the file // licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with the Business Source // License, use of this software will be governed by the Apache License, Version 2.0, // included in the file licenses/APL.txt. // Code generated by Oracle. DO NOT EDIT. import { z } from "zod"; import { id } from "@/id"; import { label } from "@/label"; import { type optional } from "@/optional"; import { telem, TimeStamp } from "@/telem"; import { zod } from "@/zod"; export const VARIANTS = [ "success", "info", "warning", "error", "loading", "disabled", ] as const; export const variantZ = z.enum(VARIANTS); export const successVariantZ = z.literal("success"); export const infoVariantZ = z.literal("info"); export const warningVariantZ = z.literal("warning"); export const errorVariantZ = z.literal("error"); export const loadingVariantZ = z.literal("loading"); export const disabledVariantZ = z.literal("disabled"); export type Variant = z.infer; export interface StatusSchemas< Details extends z.ZodType = z.ZodType, V extends z.ZodType = z.ZodType, > { details: Details; v: V; } export type StatusZodObject< Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, > = z.ZodObject<{ key: z.ZodDefault; name: z.ZodDefault; variant: V; message: z.ZodString; description: z.ZodOptional; time: z.ZodDefault; labels: ReturnType>>; details: [Details] extends [z.ZodNever] ? z.ZodOptional : Details; }>; export interface StatusZFunction { < Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, >(args: { details?: Details; v?: V; }): StatusZodObject; < Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, >( args?: Partial>, ): StatusZodObject; } export const statusZ: StatusZFunction = < Details extends z.ZodType, V extends z.ZodType, >({ details, v }: Partial> = {}) => z.object({ key: z.string().default(() => id.create()), name: z.string().default(""), variant: v ?? variantZ, message: z.string(), description: z.string().optional(), time: telem.timeStampZ.default(() => TimeStamp.now()), details: details ?? z.unknown().optional(), labels: zod.nullToUndefined(label.labelZ.array()), }); export type Status< Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, > = { key: string; name: string; variant: z.infer; message: string; description?: string; time: telem.TimeStamp; labels?: label.Label[]; } & ([Details] extends [z.ZodNever] ? {} : { details: z.infer
}); export interface NewSchemas< Details extends z.ZodType = z.ZodType, V extends z.ZodType = z.ZodType, > { details: Details; v: V; } export const newZ = < Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, >({ details, v }: Partial> = {}) => statusZ({ details, v }).partial({ key: true, name: true, time: true }); export type New< Details extends z.ZodType = z.ZodNever, V extends z.ZodType = typeof variantZ, > = optional.Optional, "key" | "name" | "time">;