/*
 * 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 { ClosedEnum } from "../../types/enums.js";

export const IntrospectTokenRequestTokenTypeHint = {
  AccessToken: "access_token",
  RefreshToken: "refresh_token",
} as const;
export type IntrospectTokenRequestTokenTypeHint = ClosedEnum<
  typeof IntrospectTokenRequestTokenTypeHint
>;

export type IntrospectTokenRequest = {
  token: string;
  tokenTypeHint?: IntrospectTokenRequestTokenTypeHint | null | undefined;
  clientId: string;
  clientSecret: string;
};

/** @internal */
export const IntrospectTokenRequestTokenTypeHint$outboundSchema: z.ZodMiniEnum<
  typeof IntrospectTokenRequestTokenTypeHint
> = z.enum(IntrospectTokenRequestTokenTypeHint);

/** @internal */
export type IntrospectTokenRequest$Outbound = {
  token: string;
  token_type_hint?: string | null | undefined;
  client_id: string;
  client_secret: string;
};

/** @internal */
export const IntrospectTokenRequest$outboundSchema: z.ZodMiniType<
  IntrospectTokenRequest$Outbound,
  IntrospectTokenRequest
> = z.pipe(
  z.object({
    token: z.string(),
    tokenTypeHint: z.optional(
      z.nullable(IntrospectTokenRequestTokenTypeHint$outboundSchema),
    ),
    clientId: z.string(),
    clientSecret: z.string(),
  }),
  z.transform((v) => {
    return remap$(v, {
      tokenTypeHint: "token_type_hint",
      clientId: "client_id",
      clientSecret: "client_secret",
    });
  }),
);

export function introspectTokenRequestToJSON(
  introspectTokenRequest: IntrospectTokenRequest,
): string {
  return JSON.stringify(
    IntrospectTokenRequest$outboundSchema.parse(introspectTokenRequest),
  );
}
