/*
 * 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 TokenTypeHint = {
  AccessToken: "access_token",
  RefreshToken: "refresh_token",
} as const;
export type TokenTypeHint = ClosedEnum<typeof TokenTypeHint>;

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

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

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

/** @internal */
export const RevokeTokenRequest$outboundSchema: z.ZodMiniType<
  RevokeTokenRequest$Outbound,
  RevokeTokenRequest
> = z.pipe(
  z.object({
    token: z.string(),
    tokenTypeHint: z.optional(z.nullable(TokenTypeHint$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 revokeTokenRequestToJSON(
  revokeTokenRequest: RevokeTokenRequest,
): string {
  return JSON.stringify(
    RevokeTokenRequest$outboundSchema.parse(revokeTokenRequest),
  );
}
