/*
 * 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";

export type V2PortalCreateSessionResponseData = {
  /**
   * The short-lived session token ID. Valid for 15 minutes and can be exchanged once for a browser session.
   *
   * @remarks
   */
  sessionId: string;
  /**
   * The full portal URL with the session parameter. Redirect the end user to this URL.
   *
   * @remarks
   */
  url: string;
};

/** @internal */
export const V2PortalCreateSessionResponseData$inboundSchema: z.ZodType<
  V2PortalCreateSessionResponseData,
  z.ZodTypeDef,
  unknown
> = z.object({
  sessionId: z.string(),
  url: z.string(),
});

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