/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type DeleteAliasRequest = {
  /**
   * The ID or alias that will be removed
   */
  aliasId: string;
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
};

export const DeleteAliasStatus = {
  Success: "SUCCESS",
} as const;
export type DeleteAliasStatus = ClosedEnum<typeof DeleteAliasStatus>;

/**
 * The alias was successfully removed
 */
export type DeleteAliasResponseBody = {
  status: DeleteAliasStatus;
};

/** @internal */
export type DeleteAliasRequest$Outbound = {
  aliasId: string;
  teamId?: string | undefined;
  slug?: string | undefined;
};

/** @internal */
export const DeleteAliasRequest$outboundSchema: z.ZodType<
  DeleteAliasRequest$Outbound,
  z.ZodTypeDef,
  DeleteAliasRequest
> = z.object({
  aliasId: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
});

export function deleteAliasRequestToJSON(
  deleteAliasRequest: DeleteAliasRequest,
): string {
  return JSON.stringify(
    DeleteAliasRequest$outboundSchema.parse(deleteAliasRequest),
  );
}

/** @internal */
export const DeleteAliasStatus$inboundSchema: z.ZodNativeEnum<
  typeof DeleteAliasStatus
> = z.nativeEnum(DeleteAliasStatus);

/** @internal */
export const DeleteAliasResponseBody$inboundSchema: z.ZodType<
  DeleteAliasResponseBody,
  z.ZodTypeDef,
  unknown
> = z.object({
  status: DeleteAliasStatus$inboundSchema,
});

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