/*
 * 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 DeleteDomainRequest = {
  /**
   * The name of the domain.
   */
  domain: 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;
};

/**
 * Successful response removing a domain.
 */
export type DeleteDomainResponseBody = {
  uid: string;
};

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

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

export function deleteDomainRequestToJSON(
  deleteDomainRequest: DeleteDomainRequest,
): string {
  return JSON.stringify(
    DeleteDomainRequest$outboundSchema.parse(deleteDomainRequest),
  );
}

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

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