/*
 * 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 { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest10Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest10Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest10Type
>;

export type RequestBodyHttps = {
  priority: number | null;
  target: string;
  params?: string | undefined;
};

export type RequestBody10 = {
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest10Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  https: RequestBodyHttps;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest9Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest9Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest9Type
>;

export type RequestBody9 = {
  /**
   * A subdomain name.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest9Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * An NS domain value.
   */
  value?: string | undefined;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest8Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest8Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest8Type
>;

export type RequestBody8 = {
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest8Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * A TXT record containing arbitrary text.
   */
  value: string;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest7Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest7Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest7Type
>;

export type RequestBodySrv = {
  priority: number | null;
  weight: number | null;
  port: number | null;
  target: string;
};

export type RequestBody7 = {
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest7Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  srv: RequestBodySrv;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest6Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest6Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest6Type
>;

export type RequestBody6 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest6Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * An MX record specifying the mail server responsible for accepting messages on behalf of the domain name.
   */
  value: string;
  mxPriority: number;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequest5Type = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequest5Type = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequest5Type
>;

export type RequestBody5 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequest5Type;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * A CNAME record mapping to another domain name.
   */
  value?: string | undefined;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsRequestType = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsRequestType = ClosedEnum<
  typeof CreateRecordRequestBodyDnsRequestType
>;

export type RequestBody4 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsRequestType;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * A CAA record to specify which Certificate Authorities (CAs) are allowed to issue certificates for the domain.
   */
  value: string;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyDnsType = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyDnsType = ClosedEnum<
  typeof CreateRecordRequestBodyDnsType
>;

export type RequestBody3 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyDnsType;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * An ALIAS virtual record pointing to a hostname resolved to an A record on server side.
   */
  value: string;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const CreateRecordRequestBodyType = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type CreateRecordRequestBodyType = ClosedEnum<
  typeof CreateRecordRequestBodyType
>;

export type RequestBody2 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: CreateRecordRequestBodyType;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * An AAAA record pointing to an IPv6 address.
   */
  value: string;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

/**
 * The type of record, it could be one of the valid DNS records.
 */
export const RequestBodyType = {
  A: "A",
  Aaaa: "AAAA",
  Alias: "ALIAS",
  Caa: "CAA",
  Cname: "CNAME",
  Https: "HTTPS",
  Mx: "MX",
  Srv: "SRV",
  Txt: "TXT",
  Ns: "NS",
} as const;
/**
 * The type of record, it could be one of the valid DNS records.
 */
export type RequestBodyType = ClosedEnum<typeof RequestBodyType>;

export type RequestBody1 = {
  /**
   * A subdomain name or an empty string for the root domain.
   */
  name: string;
  /**
   * The type of record, it could be one of the valid DNS records.
   */
  type: RequestBodyType;
  /**
   * The TTL value. Must be a number between 60 and 2147483647. Default value is 60.
   */
  ttl?: number | undefined;
  /**
   * The record value must be a valid IPv4 address.
   */
  value: string;
  /**
   * A comment to add context on what this DNS record is for
   */
  comment?: string | undefined;
};

export type CreateRecordRequestBody =
  | RequestBody6
  | RequestBody1
  | RequestBody2
  | RequestBody3
  | RequestBody4
  | RequestBody5
  | RequestBody7
  | RequestBody8
  | RequestBody9
  | RequestBody10;

export type CreateRecordRequest = {
  /**
   * The domain used to create the DNS record.
   */
  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:
    | RequestBody6
    | RequestBody1
    | RequestBody2
    | RequestBody3
    | RequestBody4
    | RequestBody5
    | RequestBody7
    | RequestBody8
    | RequestBody9
    | RequestBody10;
};

export type CreateRecordResponseBody2 = {
  /**
   * The id of the newly created DNS record
   */
  uid: string;
};

export type CreateRecordResponseBody1 = {
  uid: string;
  updated: number;
};

/**
 * Successful response showing the uid of the newly created DNS record.
 */
export type CreateRecordResponseBody =
  | CreateRecordResponseBody1
  | CreateRecordResponseBody2;

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

/** @internal */
export type RequestBodyHttps$Outbound = {
  priority: number | null;
  target: string;
  params?: string | undefined;
};

/** @internal */
export const RequestBodyHttps$outboundSchema: z.ZodType<
  RequestBodyHttps$Outbound,
  z.ZodTypeDef,
  RequestBodyHttps
> = z.object({
  priority: z.nullable(z.number()),
  target: z.string(),
  params: z.string().optional(),
});

export function requestBodyHttpsToJSON(
  requestBodyHttps: RequestBodyHttps,
): string {
  return JSON.stringify(
    RequestBodyHttps$outboundSchema.parse(requestBodyHttps),
  );
}

/** @internal */
export type RequestBody10$Outbound = {
  type: string;
  ttl?: number | undefined;
  https: RequestBodyHttps$Outbound;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody10$outboundSchema: z.ZodType<
  RequestBody10$Outbound,
  z.ZodTypeDef,
  RequestBody10
> = z.object({
  type: CreateRecordRequestBodyDnsRequest10Type$outboundSchema,
  ttl: z.number().optional(),
  https: z.lazy(() => RequestBodyHttps$outboundSchema),
  comment: z.string().optional(),
});

export function requestBody10ToJSON(requestBody10: RequestBody10): string {
  return JSON.stringify(RequestBody10$outboundSchema.parse(requestBody10));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequest9Type$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequest9Type> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequest9Type,
  );

/** @internal */
export type RequestBody9$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value?: string | undefined;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody9$outboundSchema: z.ZodType<
  RequestBody9$Outbound,
  z.ZodTypeDef,
  RequestBody9
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyDnsRequest9Type$outboundSchema,
  ttl: z.number().optional(),
  value: z.string().optional(),
  comment: z.string().optional(),
});

export function requestBody9ToJSON(requestBody9: RequestBody9): string {
  return JSON.stringify(RequestBody9$outboundSchema.parse(requestBody9));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequest8Type$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequest8Type> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequest8Type,
  );

/** @internal */
export type RequestBody8$Outbound = {
  type: string;
  ttl?: number | undefined;
  value: string;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody8$outboundSchema: z.ZodType<
  RequestBody8$Outbound,
  z.ZodTypeDef,
  RequestBody8
> = z.object({
  type: CreateRecordRequestBodyDnsRequest8Type$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  comment: z.string().optional(),
});

export function requestBody8ToJSON(requestBody8: RequestBody8): string {
  return JSON.stringify(RequestBody8$outboundSchema.parse(requestBody8));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequest7Type$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequest7Type> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequest7Type,
  );

/** @internal */
export type RequestBodySrv$Outbound = {
  priority: number | null;
  weight: number | null;
  port: number | null;
  target: string;
};

/** @internal */
export const RequestBodySrv$outboundSchema: z.ZodType<
  RequestBodySrv$Outbound,
  z.ZodTypeDef,
  RequestBodySrv
> = z.object({
  priority: z.nullable(z.number()),
  weight: z.nullable(z.number()),
  port: z.nullable(z.number()),
  target: z.string(),
});

export function requestBodySrvToJSON(requestBodySrv: RequestBodySrv): string {
  return JSON.stringify(RequestBodySrv$outboundSchema.parse(requestBodySrv));
}

/** @internal */
export type RequestBody7$Outbound = {
  type: string;
  ttl?: number | undefined;
  srv: RequestBodySrv$Outbound;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody7$outboundSchema: z.ZodType<
  RequestBody7$Outbound,
  z.ZodTypeDef,
  RequestBody7
> = z.object({
  type: CreateRecordRequestBodyDnsRequest7Type$outboundSchema,
  ttl: z.number().optional(),
  srv: z.lazy(() => RequestBodySrv$outboundSchema),
  comment: z.string().optional(),
});

export function requestBody7ToJSON(requestBody7: RequestBody7): string {
  return JSON.stringify(RequestBody7$outboundSchema.parse(requestBody7));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequest6Type$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequest6Type> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequest6Type,
  );

/** @internal */
export type RequestBody6$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value: string;
  mxPriority: number;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody6$outboundSchema: z.ZodType<
  RequestBody6$Outbound,
  z.ZodTypeDef,
  RequestBody6
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyDnsRequest6Type$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  mxPriority: z.number(),
  comment: z.string().optional(),
});

export function requestBody6ToJSON(requestBody6: RequestBody6): string {
  return JSON.stringify(RequestBody6$outboundSchema.parse(requestBody6));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequest5Type$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequest5Type> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequest5Type,
  );

/** @internal */
export type RequestBody5$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value?: string | undefined;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody5$outboundSchema: z.ZodType<
  RequestBody5$Outbound,
  z.ZodTypeDef,
  RequestBody5
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyDnsRequest5Type$outboundSchema,
  ttl: z.number().optional(),
  value: z.string().optional(),
  comment: z.string().optional(),
});

export function requestBody5ToJSON(requestBody5: RequestBody5): string {
  return JSON.stringify(RequestBody5$outboundSchema.parse(requestBody5));
}

/** @internal */
export const CreateRecordRequestBodyDnsRequestType$outboundSchema:
  z.ZodNativeEnum<typeof CreateRecordRequestBodyDnsRequestType> = z.nativeEnum(
    CreateRecordRequestBodyDnsRequestType,
  );

/** @internal */
export type RequestBody4$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value: string;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody4$outboundSchema: z.ZodType<
  RequestBody4$Outbound,
  z.ZodTypeDef,
  RequestBody4
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyDnsRequestType$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  comment: z.string().optional(),
});

export function requestBody4ToJSON(requestBody4: RequestBody4): string {
  return JSON.stringify(RequestBody4$outboundSchema.parse(requestBody4));
}

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

/** @internal */
export type RequestBody3$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value: string;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody3$outboundSchema: z.ZodType<
  RequestBody3$Outbound,
  z.ZodTypeDef,
  RequestBody3
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyDnsType$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  comment: z.string().optional(),
});

export function requestBody3ToJSON(requestBody3: RequestBody3): string {
  return JSON.stringify(RequestBody3$outboundSchema.parse(requestBody3));
}

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

/** @internal */
export type RequestBody2$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value: string;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody2$outboundSchema: z.ZodType<
  RequestBody2$Outbound,
  z.ZodTypeDef,
  RequestBody2
> = z.object({
  name: z.string(),
  type: CreateRecordRequestBodyType$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  comment: z.string().optional(),
});

export function requestBody2ToJSON(requestBody2: RequestBody2): string {
  return JSON.stringify(RequestBody2$outboundSchema.parse(requestBody2));
}

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

/** @internal */
export type RequestBody1$Outbound = {
  name: string;
  type: string;
  ttl?: number | undefined;
  value: string;
  comment?: string | undefined;
};

/** @internal */
export const RequestBody1$outboundSchema: z.ZodType<
  RequestBody1$Outbound,
  z.ZodTypeDef,
  RequestBody1
> = z.object({
  name: z.string(),
  type: RequestBodyType$outboundSchema,
  ttl: z.number().optional(),
  value: z.string(),
  comment: z.string().optional(),
});

export function requestBody1ToJSON(requestBody1: RequestBody1): string {
  return JSON.stringify(RequestBody1$outboundSchema.parse(requestBody1));
}

/** @internal */
export type CreateRecordRequestBody$Outbound =
  | RequestBody6$Outbound
  | RequestBody1$Outbound
  | RequestBody2$Outbound
  | RequestBody3$Outbound
  | RequestBody4$Outbound
  | RequestBody5$Outbound
  | RequestBody7$Outbound
  | RequestBody8$Outbound
  | RequestBody9$Outbound
  | RequestBody10$Outbound;

/** @internal */
export const CreateRecordRequestBody$outboundSchema: z.ZodType<
  CreateRecordRequestBody$Outbound,
  z.ZodTypeDef,
  CreateRecordRequestBody
> = smartUnion([
  z.lazy(() => RequestBody6$outboundSchema),
  z.lazy(() => RequestBody1$outboundSchema),
  z.lazy(() => RequestBody2$outboundSchema),
  z.lazy(() => RequestBody3$outboundSchema),
  z.lazy(() => RequestBody4$outboundSchema),
  z.lazy(() => RequestBody5$outboundSchema),
  z.lazy(() => RequestBody7$outboundSchema),
  z.lazy(() => RequestBody8$outboundSchema),
  z.lazy(() => RequestBody9$outboundSchema),
  z.lazy(() => RequestBody10$outboundSchema),
]);

export function createRecordRequestBodyToJSON(
  createRecordRequestBody: CreateRecordRequestBody,
): string {
  return JSON.stringify(
    CreateRecordRequestBody$outboundSchema.parse(createRecordRequestBody),
  );
}

/** @internal */
export type CreateRecordRequest$Outbound = {
  domain: string;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody:
    | RequestBody6$Outbound
    | RequestBody1$Outbound
    | RequestBody2$Outbound
    | RequestBody3$Outbound
    | RequestBody4$Outbound
    | RequestBody5$Outbound
    | RequestBody7$Outbound
    | RequestBody8$Outbound
    | RequestBody9$Outbound
    | RequestBody10$Outbound;
};

/** @internal */
export const CreateRecordRequest$outboundSchema: z.ZodType<
  CreateRecordRequest$Outbound,
  z.ZodTypeDef,
  CreateRecordRequest
> = z.object({
  domain: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: smartUnion([
    z.lazy(() => RequestBody6$outboundSchema),
    z.lazy(() => RequestBody1$outboundSchema),
    z.lazy(() => RequestBody2$outboundSchema),
    z.lazy(() => RequestBody3$outboundSchema),
    z.lazy(() => RequestBody4$outboundSchema),
    z.lazy(() => RequestBody5$outboundSchema),
    z.lazy(() => RequestBody7$outboundSchema),
    z.lazy(() => RequestBody8$outboundSchema),
    z.lazy(() => RequestBody9$outboundSchema),
    z.lazy(() => RequestBody10$outboundSchema),
  ]),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function createRecordRequestToJSON(
  createRecordRequest: CreateRecordRequest,
): string {
  return JSON.stringify(
    CreateRecordRequest$outboundSchema.parse(createRecordRequest),
  );
}

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

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

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

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

/** @internal */
export const CreateRecordResponseBody$inboundSchema: z.ZodType<
  CreateRecordResponseBody,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.lazy(() => CreateRecordResponseBody1$inboundSchema),
  z.lazy(() => CreateRecordResponseBody2$inboundSchema),
]);

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