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

export type DeleteAuthTokenRequest = {
  /**
   * The identifier of the token to invalidate. The special value "current" may be supplied, which invalidates the token that the HTTP request was authenticated with.
   */
  tokenId: string;
};

/**
 * Authentication token successfully deleted.
 */
export type DeleteAuthTokenResponseBody = {
  /**
   * The unique identifier of the token that was deleted.
   */
  tokenId: string;
};

/** @internal */
export type DeleteAuthTokenRequest$Outbound = {
  tokenId: string;
};

/** @internal */
export const DeleteAuthTokenRequest$outboundSchema: z.ZodType<
  DeleteAuthTokenRequest$Outbound,
  z.ZodTypeDef,
  DeleteAuthTokenRequest
> = z.object({
  tokenId: z.string(),
});

export function deleteAuthTokenRequestToJSON(
  deleteAuthTokenRequest: DeleteAuthTokenRequest,
): string {
  return JSON.stringify(
    DeleteAuthTokenRequest$outboundSchema.parse(deleteAuthTokenRequest),
  );
}

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

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