/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomerSeat, CustomerSeat$inboundSchema, CustomerSeat$Outbound, CustomerSeat$outboundSchema, } from "./customerseat.js"; /** * Sent when a new customer seat is assigned. * * @remarks * * This event is triggered when a seat is assigned to a customer by the organization. * The customer will receive an invitation email to claim the seat. */ export type WebhookCustomerSeatAssignedPayload = { type: "customer_seat.assigned"; timestamp: Date; data: CustomerSeat; }; /** @internal */ export const WebhookCustomerSeatAssignedPayload$inboundSchema: z.ZodMiniType< WebhookCustomerSeatAssignedPayload, unknown > = z.object({ type: z.literal("customer_seat.assigned"), timestamp: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), data: CustomerSeat$inboundSchema, }); /** @internal */ export type WebhookCustomerSeatAssignedPayload$Outbound = { type: "customer_seat.assigned"; timestamp: string; data: CustomerSeat$Outbound; }; /** @internal */ export const WebhookCustomerSeatAssignedPayload$outboundSchema: z.ZodMiniType< WebhookCustomerSeatAssignedPayload$Outbound, WebhookCustomerSeatAssignedPayload > = z.object({ type: z.literal("customer_seat.assigned"), timestamp: z.pipe(z.date(), z.transform(v => v.toISOString())), data: CustomerSeat$outboundSchema, }); export function webhookCustomerSeatAssignedPayloadToJSON( webhookCustomerSeatAssignedPayload: WebhookCustomerSeatAssignedPayload, ): string { return JSON.stringify( WebhookCustomerSeatAssignedPayload$outboundSchema.parse( webhookCustomerSeatAssignedPayload, ), ); } export function webhookCustomerSeatAssignedPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookCustomerSeatAssignedPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookCustomerSeatAssignedPayload' from JSON`, ); }