/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 7b19e0a41e95
 */

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  VoiceAppearance,
  VoiceAppearance$Outbound,
  VoiceAppearance$outboundSchema,
} from "./voiceappearance.js";

/**
 * Request model for creating a new voice with base64 audio.
 */
export type VoiceCreateRequest = {
  name: string;
  slug?: string | null | undefined;
  languages?: Array<string> | undefined;
  gender?: string | null | undefined;
  age?: number | null | undefined;
  tags?: Array<string> | null | undefined;
  color?: string | null | undefined;
  description?: string | null | undefined;
  appearance?: VoiceAppearance | null | undefined;
  retentionNotice?: number | undefined;
  /**
   * Base64-encoded audio file
   */
  sampleAudio: string;
  /**
   * Original filename for extension detection
   */
  sampleFilename?: string | null | undefined;
};

/** @internal */
export type VoiceCreateRequest$Outbound = {
  name: string;
  slug?: string | null | undefined;
  languages?: Array<string> | undefined;
  gender?: string | null | undefined;
  age?: number | null | undefined;
  tags?: Array<string> | null | undefined;
  color?: string | null | undefined;
  description?: string | null | undefined;
  appearance?: VoiceAppearance$Outbound | null | undefined;
  retention_notice: number;
  sample_audio: string;
  sample_filename?: string | null | undefined;
};

/** @internal */
export const VoiceCreateRequest$outboundSchema: z.ZodType<
  VoiceCreateRequest$Outbound,
  VoiceCreateRequest
> = z.object({
  name: z.string(),
  slug: z.nullable(z.string()).optional(),
  languages: z.array(z.string()).optional(),
  gender: z.nullable(z.string()).optional(),
  age: z.nullable(z.int()).optional(),
  tags: z.nullable(z.array(z.string())).optional(),
  color: z.nullable(z.string()).optional(),
  description: z.nullable(z.string()).optional(),
  appearance: z.nullable(VoiceAppearance$outboundSchema).optional(),
  retentionNotice: z.int().default(30),
  sampleAudio: z.string(),
  sampleFilename: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    retentionNotice: "retention_notice",
    sampleAudio: "sample_audio",
    sampleFilename: "sample_filename",
  });
});

export function voiceCreateRequestToJSON(
  voiceCreateRequest: VoiceCreateRequest,
): string {
  return JSON.stringify(
    VoiceCreateRequest$outboundSchema.parse(voiceCreateRequest),
  );
}
