/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { Meta, Meta$inboundSchema } from "./meta.js";
import {
  V2PortalCreateSessionResponseData,
  V2PortalCreateSessionResponseData$inboundSchema,
} from "./v2portalcreatesessionresponsedata.js";

export type V2PortalCreateSessionResponseBody = {
  /**
   * Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
   */
  meta: Meta;
  data: V2PortalCreateSessionResponseData;
};

/** @internal */
export const V2PortalCreateSessionResponseBody$inboundSchema: z.ZodType<
  V2PortalCreateSessionResponseBody,
  z.ZodTypeDef,
  unknown
> = z.object({
  meta: Meta$inboundSchema,
  data: V2PortalCreateSessionResponseData$inboundSchema,
});

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