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

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

export const ArchiveFTModelOutObject = {
  Model: "model",
} as const;
export type ArchiveFTModelOutObject = ClosedEnum<
  typeof ArchiveFTModelOutObject
>;

export type ArchiveFTModelOut = {
  id: string;
  object?: ArchiveFTModelOutObject | undefined;
  archived?: boolean | undefined;
};

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

/** @internal */
export const ArchiveFTModelOutObject$outboundSchema: z.ZodNativeEnum<
  typeof ArchiveFTModelOutObject
> = ArchiveFTModelOutObject$inboundSchema;

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace ArchiveFTModelOutObject$ {
  /** @deprecated use `ArchiveFTModelOutObject$inboundSchema` instead. */
  export const inboundSchema = ArchiveFTModelOutObject$inboundSchema;
  /** @deprecated use `ArchiveFTModelOutObject$outboundSchema` instead. */
  export const outboundSchema = ArchiveFTModelOutObject$outboundSchema;
}

/** @internal */
export const ArchiveFTModelOut$inboundSchema: z.ZodType<
  ArchiveFTModelOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  object: ArchiveFTModelOutObject$inboundSchema.default("model"),
  archived: z.boolean().default(true),
});

/** @internal */
export type ArchiveFTModelOut$Outbound = {
  id: string;
  object: string;
  archived: boolean;
};

/** @internal */
export const ArchiveFTModelOut$outboundSchema: z.ZodType<
  ArchiveFTModelOut$Outbound,
  z.ZodTypeDef,
  ArchiveFTModelOut
> = z.object({
  id: z.string(),
  object: ArchiveFTModelOutObject$outboundSchema.default("model"),
  archived: z.boolean().default(true),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace ArchiveFTModelOut$ {
  /** @deprecated use `ArchiveFTModelOut$inboundSchema` instead. */
  export const inboundSchema = ArchiveFTModelOut$inboundSchema;
  /** @deprecated use `ArchiveFTModelOut$outboundSchema` instead. */
  export const outboundSchema = ArchiveFTModelOut$outboundSchema;
  /** @deprecated use `ArchiveFTModelOut$Outbound` instead. */
  export type Outbound = ArchiveFTModelOut$Outbound;
}

export function archiveFTModelOutToJSON(
  archiveFTModelOut: ArchiveFTModelOut,
): string {
  return JSON.stringify(
    ArchiveFTModelOut$outboundSchema.parse(archiveFTModelOut),
  );
}

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