/*
 * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type CovariateInfoRep = {
  /**
   * The ID of the covariate matrix
   */
  id: string;
  /**
   * The file name of the uploaded covariate matrix
   */
  fileName: string;
  createdAt: number;
};

/** @internal */
export const CovariateInfoRep$inboundSchema: z.ZodType<
  CovariateInfoRep,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  fileName: z.string(),
  createdAt: z.number().int(),
});
/** @internal */
export type CovariateInfoRep$Outbound = {
  id: string;
  fileName: string;
  createdAt: number;
};

/** @internal */
export const CovariateInfoRep$outboundSchema: z.ZodType<
  CovariateInfoRep$Outbound,
  z.ZodTypeDef,
  CovariateInfoRep
> = z.object({
  id: z.string(),
  fileName: z.string(),
  createdAt: z.number().int(),
});

export function covariateInfoRepToJSON(
  covariateInfoRep: CovariateInfoRep,
): string {
  return JSON.stringify(
    CovariateInfoRep$outboundSchema.parse(covariateInfoRep),
  );
}
export function covariateInfoRepFromJSON(
  jsonString: string,
): SafeParseResult<CovariateInfoRep, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CovariateInfoRep$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CovariateInfoRep' from JSON`,
  );
}
