/*
 * 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 V2ApisGetApiResponseData = {
  /**
   * The unique identifier of this API within Unkey's system.
   *
   * @remarks
   * Used in all operations related to this API including key creation, verification, and management.
   * Always begins with 'api_' followed by alphanumeric characters and underscores.
   * This identifier is permanent and never changes after API creation.
   */
  id: string;
  /**
   * The internal name of this API as specified during creation.
   *
   * @remarks
   * Used for organization and identification within your workspace.
   * Helps distinguish between different environments, services, or access tiers.
   * Not visible to end users - this is purely for administrative purposes.
   */
  name: string;
};

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

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