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

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

export type RemoveProjectDomainRequestBody = {
  /**
   * Whether to remove all domains from this project that redirect to the domain being removed.
   */
  removeRedirects?: boolean | undefined;
};

export type RemoveProjectDomainRequest = {
  /**
   * The unique project identifier or the project name
   */
  idOrName: string;
  /**
   * The project domain name
   */
  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;
  requestBody?: RemoveProjectDomainRequestBody | undefined;
};

/**
 * The domain was succesfully removed from the project
 */
export type RemoveProjectDomainResponseBody = {};

/** @internal */
export type RemoveProjectDomainRequestBody$Outbound = {
  removeRedirects?: boolean | undefined;
};

/** @internal */
export const RemoveProjectDomainRequestBody$outboundSchema: z.ZodType<
  RemoveProjectDomainRequestBody$Outbound,
  z.ZodTypeDef,
  RemoveProjectDomainRequestBody
> = z.object({
  removeRedirects: z.boolean().optional(),
});

export function removeProjectDomainRequestBodyToJSON(
  removeProjectDomainRequestBody: RemoveProjectDomainRequestBody,
): string {
  return JSON.stringify(
    RemoveProjectDomainRequestBody$outboundSchema.parse(
      removeProjectDomainRequestBody,
    ),
  );
}

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

/** @internal */
export const RemoveProjectDomainRequest$outboundSchema: z.ZodType<
  RemoveProjectDomainRequest$Outbound,
  z.ZodTypeDef,
  RemoveProjectDomainRequest
> = z.object({
  idOrName: z.string(),
  domain: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => RemoveProjectDomainRequestBody$outboundSchema)
    .optional(),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function removeProjectDomainRequestToJSON(
  removeProjectDomainRequest: RemoveProjectDomainRequest,
): string {
  return JSON.stringify(
    RemoveProjectDomainRequest$outboundSchema.parse(removeProjectDomainRequest),
  );
}

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

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