/*
 * 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 * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { Tab, Tab$inboundSchema } from "./tab.js";

export type TabInfo = {
  /**
   * Unique ID of the installed extension app
   */
  appId: string;
  /**
   * Tab data representing the tabs associated with installed apps in the account
   */
  tabs: Array<Tab>;
};

/** @internal */
export const TabInfo$inboundSchema: z.ZodType<TabInfo, z.ZodTypeDef, unknown> =
  z.object({
    appId: types.string(),
    tabs: z.array(Tab$inboundSchema),
  });

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