/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { smartUnion } from "../../types/smartUnion.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type Meta = string | number | number | boolean;
export type LicenseKeyActivationBase = {
id: string;
licenseKeyId: string;
label: string;
meta: { [k: string]: string | number | number | boolean };
createdAt: Date;
modifiedAt: Date | null;
};
/** @internal */
export const Meta$inboundSchema: z.ZodMiniType = smartUnion([
z.string(),
z.int(),
z.number(),
z.boolean(),
]);
export function metaFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => Meta$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Meta' from JSON`,
);
}
/** @internal */
export const LicenseKeyActivationBase$inboundSchema: z.ZodMiniType<
LicenseKeyActivationBase,
unknown
> = z.pipe(
z.object({
id: z.string(),
license_key_id: z.string(),
label: z.string(),
meta: z.record(
z.string(),
smartUnion([z.string(), z.int(), z.number(), z.boolean()]),
),
created_at: z.pipe(
z.iso.datetime({ offset: true }),
z.transform(v => new Date(v)),
),
modified_at: z.nullable(
z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))),
),
}),
z.transform((v) => {
return remap$(v, {
"license_key_id": "licenseKeyId",
"created_at": "createdAt",
"modified_at": "modifiedAt",
});
}),
);
export function licenseKeyActivationBaseFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => LicenseKeyActivationBase$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'LicenseKeyActivationBase' from JSON`,
);
}