/*
 * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { CustomerSeat, CustomerSeat$inboundSchema } from "./customerseat.js";

/**
 * Response after successfully claiming a seat.
 */
export type CustomerSeatClaimResponse = {
  seat: CustomerSeat;
  /**
   * Session token for immediate customer portal access
   */
  customerSessionToken: string;
};

/** @internal */
export const CustomerSeatClaimResponse$inboundSchema: z.ZodMiniType<
  CustomerSeatClaimResponse,
  unknown
> = z.pipe(
  z.object({
    seat: CustomerSeat$inboundSchema,
    customer_session_token: z.string(),
  }),
  z.transform((v) => {
    return remap$(v, {
      "customer_session_token": "customerSessionToken",
    });
  }),
);

export function customerSeatClaimResponseFromJSON(
  jsonString: string,
): SafeParseResult<CustomerSeatClaimResponse, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomerSeatClaimResponse$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomerSeatClaimResponse' from JSON`,
  );
}
